# Manejo de interrupciones
from machine import Pin
from time import sleep
boton = False
# Se define la función interrupción
def inter(pin):
global boton
boton = True
global pin_int
pin_int = pin
led = Pin(3, Pin.OUT)
p19 = Pin(19, Pin.IN)
p19.irq(trigger=Pin.IRQ_RISING, handler=inter) # Handler = controlador, manejador
while True:
if boton: # Si se oprime el boton
print("Interrupción detectada:", pin_int)
led.on()
sleep(0.1)
led.off()
boton = False