Problem when initialising Timer
tmsch13 opened this issue · 1 comments
tmsch13 commented
Playing around with Timers in the microPython Simulator I found out that import machine
does not import machine.Timer
so:
import machine
def mycallback(t):
print("timer fired")
timer = Timer(period=1000, mode=Timer.PERIODIC, callback=mycallback)
gives me:
Traceback (most recent call last):
File "main.py", line 7, in <module>
NameError: name 'Timer' isn't defined
but
from machine import Timer
def mycallback(t):
print("timer fired")
timer = Timer(period=1000, mode=Timer.PERIODIC, callback=mycallback)
works perfectly.
I would expect importing machine would import machine.Timer to, as it also does for machine.Pin for example.