A Light Distraction

And other terrible puns

Vital Statistics

Name
Dave Jones
Twitter
@waveform80
GitHub
github.com/waveform80

Traffic Lights

  • Two roads
  • A cross-road
  • One universal pedestrian crossing

Traffic Lights

Your Mission

  • Optimize traffic flow
  • Avoid killing people

Library: gpiozero


            from gpiozero import TrafficLights, Button

            lights = TrafficLights(21, 20, 16)
            button = Button(5)
            

API: TrafficLights


            lights.on()
            lights.off()
            lights.red.on()
            lights.amber.on()
            lights.green.off()
            lights.value = (1, 1, 0)
            

API: Button


            def my_func():
                print("Don't push the button!")

            button.when_pressed = my_func
            

GO!

github.com/waveform80/traffic_lights

Vital Statistics

Name
Dave Jones
Occupation
Road Warrior
Twitter
@waveform80
GitHub
github.com/waveform80

Available Now!

from your nearest web-server

gpiozero.readthedocs.org
www.waveform.org.uk/presentations/traffic_lights/

Thank You

Questions? Pub!