import machine
import time
# Connect your LEDs to these GPIO pins on your Wokwi Raspberry Pi Pico
red_led = machine.Pin(15, machine.Pin.OUT)
yellow_led = machine.Pin(14, machine.Pin.OUT)
green_led = machine.Pin(13, machine.Pin.OUT)
while True:
# 1. Red Light (Stop)
red_led.value(1)
yellow_led.value(0)
green_led.value(0)
time.sleep(3) # Wait for 3 seconds
# 2. Green Light (Go)
red_led.value(0)
yellow_led.value(0)
green_led.value(1)
time.sleep(3) # Wait for 3 seconds
# 3. Yellow Light (Slow down / Prepare to stop)
red_led.value(0)
yellow_led.value(1)
green_led.value(0)
time.sleep(1) # Wait for 1 seconds