Last active
February 8, 2016 18:35
-
-
Save bennuttall/4b2d9004736d5068e3c5 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 gpiozero import TrafficLights | |
lights = TrafficLights(4, 5, 6, pwm=True) | |
def pulse(): | |
while True: | |
for i in range(10): | |
lights.green.value = i / 10 | |
sleep(0.01) | |
for i in reversed(range(10)): | |
lights.green.value = i / 10 | |
sleep(0.01) | |
lights.red.source = lights.green.values | |
lights.amber.source = lights.green.values | |
pulse() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment