Code: Select all
from machine import Timer
if (IsPico() or IsPicoW()):
theTimer=Timer(-1, period=1000*60, mode=Timer.PERIODIC, callback=Ping)
elif (IsESP01() or IsESP8266 or IsESP32()):
theTimer=Timer(-1)
theTimer.init(period=1000*60, mode=Timer.PERIODIC, callback=Ping)
Here is the interesting part... "theTimer=Timer(-ONE, period=1000*60, mode=Timer.PERIODIC, callback=Ping)" Fails on ESP modules, but works on Picos? Is this by design. intentional? On ESP module, the error returned is "TypeError: function takes 1 positional arguments but 4 were given." So the ESP Timer() invocation can't mirror the Pico invocation at all.
If so, why? Would you not want the same declaration to work on different ports, so make documentation streamline and consistent? Development more universal? Not sure I see the logic of the ESP port working one way versus the Pico port another way.