from gpiozero import TrafficLights, Button
from time import sleep
from signal import pause

feu = TrafficLights(16, 20, 21)
bouton = Button(24)

feu.value = (1, 1, 1) # éteindre les LED
print ("LED éteintes")
sleep (3)

def sequence_du_feu():
    while True:
        yield (0, 0, 1) # feu vert
        bouton.wait_for_press()
        print("Appui")
        sleep(2)
        yield (0, 1, 0) # feu orange
        sleep(2)
        yield (1, 0, 0) # feu rouge
        sleep(5)

feu.source=sequence_du_feu()

pause() 
