From 70b253c85fbd818f4f0b90550016dbfd21ab1996 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 21 Mar 2021 08:40:47 +0100 Subject: [PATCH] Add kitronic 4 and 5 --- kitronic_04.py | 18 ++++++++++++++++++ kitronic_05.py | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 kitronic_04.py create mode 100644 kitronic_05.py diff --git a/kitronic_04.py b/kitronic_04.py new file mode 100644 index 0000000..8b93fe4 --- /dev/null +++ b/kitronic_04.py @@ -0,0 +1,18 @@ +from microbit import * + + +def main(): + duty = 0 + while True: + while duty < 1023: + pin0.write_analog(duty) + duty += 1 + sleep(10) + while duty > 0: + pin0.write_analog(duty) + duty -= 1 + sleep(10) + + +if __name__ == "__main__": + main() diff --git a/kitronic_05.py b/kitronic_05.py new file mode 100644 index 0000000..0369e5a --- /dev/null +++ b/kitronic_05.py @@ -0,0 +1,11 @@ +from microbit import * + + +def main(): + while True: + value = min(1023, abs(accelerometer.get_y())) + pin0.write_analog(value) + + +if __name__ == "__main__": + main()