from machine import Pin
from utime import sleep, sleep_ms

led_rojo = Pin(26, Pin.OUT)
led_amarillo = Pin(25, Pin.OUT)
sensor = Pin(4, Pin.IN)


while True:
    dato = sensor.value()
    print(dato)
    sleep_ms(50)
    if dato == 1:
        led_rojo.on()
        led_amarillo.off()
    else:
        led_rojo.off()
        led_amarillo.on()