from machine import Pin
from utime import sleep,ticks_ms
import tm1637 as tm
seg7=tm.TM1637(clk=Pin(0), dio=Pin(1))
button_1=Pin(7,Pin.IN,Pin.PULL_UP)
button_2=Pin(15,Pin.IN,Pin.PULL_UP)
count=0
debounce=0
def act1(button_1):
global count,debounce
if ticks_ms()-debounce>50:
count+=1
debounce=ticks_ms()
button_1.irq(trigger=Pin.IRQ_FALLING, handler=act1)
def act2(button_2):
global count,debounce
if ticks_ms()-debounce>50:
count-=1
debounce=ticks_ms()
button_2.irq(trigger=Pin.IRQ_FALLING, handler=act2)
while 1:
seg7.number(count)
sleep(0.2)