""" filename:gpio_RPi_TrafficLights.py Beginner Project - Traffic Lights written by Trevor Olsson © GPIO Support Services LTD MMXVII More info here: http://www.gpio.co.uk/traffic-lights/ and here: https://gpiozero.readthedocs.io/en/stable/api_boards.html """ from gpiozero import TrafficLights from time import sleep traffic = TrafficLights(17,18,27,initial_value=False) # Choose outputs to use and turn off at start while True: traffic.red.on() sleep(2) traffic.amber.on() sleep(2) traffic.red.off() traffic.amber.off() traffic.green.on() sleep(2) traffic.green.off() traffic.amber.on() sleep(2) traffic.amber.off()