]>
vault307.fbx.one Git - Sensory_Wall.git/blob - trafficLight.py
1 from machine
import Pin
3 from random
import randint
5 btn
=Pin(12,Pin
.IN
,Pin
.PULL_UP
)
10 yellow
=Pin(14,Pin
.OUT
)
13 #start with lights off
18 #2 modes, manual and random
19 # TODO set up selector between manual (button op) and random time (randint)
20 toggle
=Pin(pin
,Pin
.IN
,Pin
.PULL_UP
)
27 #run automatically, random.randint(?,?), 1 LED color at a time
30 #use button to change LED
35 ###CREATE MAIN LOOP###
36 """ use toggle to determine which control to give (auto or manual)
37 probably check toggle status before running any subroutines, need to check status of this item first,
38 and detect fresh changes on Pin as they come in, IRQ
39 if auto, use random times to switch between lights, turning on new light, off old light
40 if manual, need to read for button presses and use that to move through lights
41 need to set up cases, OFF(no LED), RED(red only), YELLOW(yellow only), GREEN(green only)
47 time
.sleep(random
.randint(5,60))
50 time
.sleep(random
.randint(5,60))
53 time
.sleep(random
.randint(5,60))