You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
delay() in setup - The delay prevents a task from executing. #214
You've coded two delay(x) in the setup function. That adds up to 3 seconds.
However, the scheduler doesn’t start until **ts.execute()** is called in loop().
By that point, more than 3 seconds have passed, but several 500-ms intervals have already elapsed.
The library attempts to catch up on these missed intervals.
This results in rapid function calls.
To measure the time, I modified the blink1CB() function:
Monitor output:
3027: Blink1 - simple flag driven Call: 1 at 3027ms
Call: 2 at 3027ms
Call: 3 at 3027ms
Call: 4 at 3027ms
Call: 5 at 3027ms
Call: 6 at 3027ms
Call: 7 at 3038ms
Call: 8 at 3501ms
Call: 9 at 4001ms
Call: 10 at 4501ms
Call: 11 at 5001ms
Call: 12 at 5501ms
Call: 13 at 6001ms
Call: 14 at 6501ms
Call: 15 at 7001ms
Call: 16 at 7501ms
Call: 17 at 8001ms
Call: 18 at 8501ms
Call: 19 at 9001ms
Call: 20 at 9501ms
The first 7 function calls occur within 10 ms; after that, everything works as intended every 500 ms.
Solution: Start the task only after initialization (after the delays).
Conclusion:
Task tBlink1(PERIOD1, DURATION / PERIOD1, &blink1CB, &ts, false);
At the end of Setup tBlink1.enableDelayed(PERIOD1);
Activity
arkhipenko commentedon Oct 21, 2026
confirm. will be fixed in the next release
v4.1.1: examples call startNow() at end of setup(), Blink Approach 5 …