-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Hello,
My code has a lot of Delay()'s in it and looking to remove them so other callbacks can fire when needed.
Your library looks perfect for everything but my mental power cannot seem to figure out how to make a simple 3 second timer that does nothing. A callback is not really needed but created one that prints to the serial line, timer 1 callback fired...
For example, the Arduino needs to wait for devices to come online, 3 seconds is a good time. However, during that time the devices can be coming online and saying hello through a callback. The Delay() will miss these hello messages, correct?
I don't need/want this to fire every 3 seconds, only once.
Later make it a 10ms timer,
I can picture using 1 timer and changing its parameters when I need to use it.
There seems to be 2 ways to do it:
-
Using the public variables provided by Task. - lastCallTimeMicros and periodMicros, nowMicros, and somewhere I read nowMicros set to mills() will reset it?
-
Create 2 timers, using SoftTimer.add(task) and SoftTimer.remove(task) and a global variable that would be changed in the callback, TimerDone = true; for example, use a While loop until the global variable is set, clear it, reset timer?
I must be clearly missing something obvious here and have done too much reading. :)