from machine import Pin,PWM
from time import sleep
auto_verde = Pin(6, Pin.OUT)
auto_rojo = Pin(11, Pin.OUT)
peaton = Pin(3,Pin.OUT)
boton = Pin(17,Pin.IN,Pin.PULL_DOWN)
buzzer = PWM(Pin(15))
while True:
auto_verde.on()
auto_rojo.off()
peaton.off()
buzzer.duty_u16(0)
if boton.value() == 1:
buzzer.freq(1000)
buzzer.duty_u16(30000)
auto_verde.off()
auto_rojo.on()
sleep(1)
peaton.on()
sleep(4)
peaton.off()
sleep(1)
auto_rojo.off()
sleep(0.5)