Add kitronic 3

This commit is contained in:
Gabriel Augendre 2021-03-21 08:17:45 +01:00
parent f5aeced9cc
commit 4f2befc8f0
2 changed files with 20 additions and 0 deletions

20
kitronic_03.py Normal file
View file

@ -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()

0
minifyflash Normal file → Executable file
View file