From 4f2befc8f0dbf3d913baa3ef46f193405ef1d4b7 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 21 Mar 2021 08:17:45 +0100 Subject: [PATCH] Add kitronic 3 --- kitronic_03.py | 20 ++++++++++++++++++++ minifyflash | 0 2 files changed, 20 insertions(+) create mode 100644 kitronic_03.py mode change 100644 => 100755 minifyflash diff --git a/kitronic_03.py b/kitronic_03.py new file mode 100644 index 0000000..ecdaab9 --- /dev/null +++ b/kitronic_03.py @@ -0,0 +1,20 @@ +from microbit import * + + +def main(): + light_on = False + touched = False + while True: + if pin0.is_touched() and not touched: + light_on = not light_on + touched = True + if not pin0.is_touched(): + touched = False + if light_on: + pin2.write_analog(pin1.read_analog()) + else: + pin2.write_digital(0) + + +if __name__ == "__main__": + main() diff --git a/minifyflash b/minifyflash old mode 100644 new mode 100755