I am trying to make sense of the micropython timer.callback() function, but I can't say I understand it very well.
My idea was to use the following code to call a function every 1 second:
Code: Select all
import pyb
import time
def tick():
print(time.ticks_ms())
# Create timer which calls the function 'tick' every second
tim = pyb.Timer(1, freq=1)
tim.callback(tick)
Code: Select all
>>> uncaught exception in Timer(1) interrupt handler
TypeError:
Many thanks in advance!