Setiawan <stwn at unsoed.ac.id> Simple Traffic Light Simulation 2 • Create a new file, traffic_light2.py • Type this code, save, and run from gpiozero import TrafficLights from time import sleep from signal import pause lights = TrafficLights(4, 12, 21) def light_sequence(): while True: yield(1, 0, 0) #red sleep(10) yield(0, 1, 0) #amber sleep(1) yield(0, 0, 1) #green sleep(10) yield(0, 1, 0) #amber again sleep(1) lights.source = light_sequence() pause() * https://gpiozero.readthedocs.io/en/stable/recipes.html#traffic-lights