Change task interval during execution #158
-
Hello,
Somewhere in execution i would like to change the interval, is it best way to change the interval by reintialize(interval = 10000) or is there a better way to change the interval of task "testTask". Reason to change the interval of task is to update/change exectution of task interval like printing or publishing data through mqtt at different intervals rather than being fixed. Just recently came across this library, and it is one of the best arduino & esp boards libraries out there, thank you. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, please read the Wiki (paying specific attention to NOTES) https://github.com/arkhipenko/TaskScheduler/wiki/API-Task#void-setinterval-unsigned-long-ainterval and an example: You can set it in the Task's own callback method, or outside of the task code, in another task's callback method. |
Beta Was this translation helpful? Give feedback.
Yes, please read the Wiki (paying specific attention to NOTES)
https://github.com/arkhipenko/TaskScheduler/wiki/API-Task#void-setinterval-unsigned-long-ainterval
and an example:
TaskScheduler/examples/Scheduler_example00_Blink/Scheduler_example00_Blink.ino
Line 284 in 4ccca1a
You can set it in the Task's own callback method, or outside of the task code, in another task's callback method.