from machine import Pin, Timer from time import sleep_ms led = Pin(17, Pin.OUT) tim = Timer() N = 0 def tic(timer): global N N += 1 tim.init(freq=1, mode=Timer.PERIODIC, callback=tic) while(1): print(N) sleep_ms(100)