from machine import Pin,Timer
from time import sleep
clk = Pin(2,Pin.IN) # clk
dt = Pin(3,Pin.IN) # dt
count=20
def clk_change(clk):
global count
if dt.value()==1:
count=count+1
else:
count=count-1
print(count)
clk.irq(trigger=Pin.IRQ_FALLING, handler=clk_change)
while 1:
#print(count)
sleep(0.5)