import time
from machine import Pin,Timer
led = Pin(27,Pin.OUT,value = 0)
active = 1
def tim_isr(p):
global active, count
count += 1
active = 1
def botton_isr(p):
global active
if (active == 1):
led.toggle()
time.sleep_ms(300)
active = 0
tim1 = Timer(period = 30, mode = Timer.ONE_SHOT, callback=tim_isr)
botton = Pin(6, mode=Pin.IN,pull=Pin.PULL_DOWN)
botton.irq(trigger=Pin.IRQ_FALLING,handler=botton_isr)
count = 0
while True:
print(count)