We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20bbf77 commit 6e27619Copy full SHA for 6e27619
timings/monotonic_loop.py
@@ -1,5 +1,9 @@
1
"""
2
+Loop with 2 timers, using time.monotonic()
3
4
+NOTE: time.monotonic() loses precision after many hours of running.
5
+Prefer using time.monotonic_ns() on boards that support it.
6
+Since monotonic_ns is in nano seconds, you have to adapt the delays.
7
8
import time
9
@@ -8,10 +12,6 @@
12
# every 2 seconds:
13
TIMER_2_DELAY = 2
10
14
11
-# NOTE: time.monotonic() loses precision after many hours of running.
-# Prefer using time.monotonic_ns() on boards that support it.
-# Since monotonic_ns is in nano seconds, you have to adapt the delays.
-
15
# Change *_next_run to now or 0 if you want to trigger it on the first loop.
16
# Or "now + X" to trigger at a different time the first time.
17
now = time.monotonic()
0 commit comments