from machine import Pin
from utime import sleep
# Define pins for LEDs
yellow = Pin(5, Pin.OUT)
red = Pin(6, Pin.OUT)
green = Pin(7, Pin.OUT)
print("Traffic Light Simulation Started!")
while True:
# Red ON
red.value(1)
yellow.value(0)
green.value(0)
print("STOP - Red Light")
sleep(3)
# Yellow ON
red.value(0)
yellow.value(1)
green.value(0)
print("READY - Yellow Light")
sleep(2)
# Green ON
red.value(0)
yellow.value(0)
green.value(1)
print("GO - Green Light")
sleep(3)