from machine import Pin
import time
led_pin = 14
switch_pin = 13
red_led = Pin(led_pin, Pin.OUT)
switch = Pin(switch_pin, Pin.OUT)
RED = 0
current_state = RED
def update_traffic_light():
global current_state
if current_state == RED:
red_led.value(1)
time.sleep(0)
current_state = RED
while True:
if switch.value() == 0:
update_traffic_light()