Library in MicroPython for timers without interrupt:
- Mode one shot or periodic
- The one shot timer can be armed after its instantiation.
- The one shot timer can be rearmed at any time.
This driver has no dependency
Copy the file timer.py in your project folder.
.. code-block:: micropython
from timer import OneShotTimer, PeriodicTimer
my_timer = OneShotTimer(3600000) # Time in ms
while not my_timer.is_activated:
pass # My work.
my_timer.start(7200000) # Time in ms
while not my_timer.is_activated:
pass # My entertainment.
my_timer = PeriodicTimer(1000) # Time in ms
while True:
if my_timer.is_activated:
pass # My periodic action
Read the code.
Contributions are welcome!