import utime
from machine import Pin
utime.sleep(0.1)
led1 = Pin(0, Pin.OUT)
boton = Pin(27, Pin.IN, Pin.PULL_DOWN)
estado_anterior = 0
while True:
estado_actual = boton.value()
# Detecta el flanco de subida (0 -> 1)
if estado_anterior == 0 and estado_actual == 1:
print("Se presionó")
estado_anterior = estado_actual
utime.sleep_ms(10)