Skip to content

Instantly share code, notes, and snippets.

@bennuttall
Last active February 8, 2016 18:35
Show Gist options
  • Save bennuttall/4b2d9004736d5068e3c5 to your computer and use it in GitHub Desktop.
Save bennuttall/4b2d9004736d5068e3c5 to your computer and use it in GitHub Desktop.
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