mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Convert recipe examples to includes
Makes it much easier to test things - no copying'n'pasting just run the examples straight from the dir (after wiring stuff up)
This commit is contained in:
24
docs/examples/traffic_lights_3.py
Normal file
24
docs/examples/traffic_lights_3.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from gpiozero import LED
|
||||
from time import sleep
|
||||
|
||||
red = LED(2)
|
||||
amber = LED(3)
|
||||
green = LED(4)
|
||||
|
||||
green.on()
|
||||
amber.off()
|
||||
red.off()
|
||||
|
||||
while True:
|
||||
sleep(10)
|
||||
green.off()
|
||||
amber.on()
|
||||
sleep(1)
|
||||
amber.off()
|
||||
red.on()
|
||||
sleep(10)
|
||||
amber.on()
|
||||
sleep(1)
|
||||
green.on()
|
||||
amber.off()
|
||||
red.off()
|
||||
Reference in New Issue
Block a user