import machine
import time
# Define the pins connected to the traffic lights
red_pin = machine.Pin(23, machine.Pin.OUT)
yellow_pin = machine.Pin(22, machine.Pin.OUT)
green_pin = machine.Pin(21, machine.Pin.OUT)
# Define the time intervals for each light
red_duration = 10
yellow_duration = 20
green_duration = 30
while True:
red_pin.on()
time.sleep(red_duration)
red_pin.off()
yellow_pin.on()
time.sleep(yellow_duration)
yellow_pin.off()
green_pin.on()
time.sleep(green_duration)
green_pin.off()