from machine import Pin, Timer
import time
led = Pin(0, Pin.OUT)
boton = Pin(16, Pin.IN, Pin.PULL_UP)
tim1 = Timer()
tim2 = Timer()
def tempo1(tim1):
led.toggle()
def tempo2(tim2):
tim1.deinit()
# led.value(0)
def fun_boton(boton):
tim1.init(freq=5, mode=Timer.PERIODIC, callback=tempo1)
tim2.init(period=5000, mode=Timer.ONE_SHOT, callback=tempo2)
boton.irq(trigger=Pin.IRQ_FALLING, handler=fun_boton)
while True:
pass