Created
January 10, 2018 19:09
-
-
Save anonymous/2b99ef99e14837a00805dfbd6106dc2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyb import LED | |
from pyb import Pin | |
from pyb import Switch | |
import time | |
sw = Switch() | |
# 1 red, 2 green, 3 yellow, 4 blue | |
ledg = LED(2) | |
ledb = LED(4) | |
p_in = Pin('X2', Pin.IN, Pin.PULL_UP) | |
camera = 0 | |
while True: | |
#if (p_in.value()): | |
if sw(): | |
if camera < 5: | |
camera += 1 | |
else: | |
camera = 0 | |
ledg.on() | |
ledb.off() | |
f = open('camera.txt', 'w') | |
f.write(str(camera)) | |
print(str(camera)) | |
f.close() | |
else: | |
ledb.on() | |
ledg.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment