Help find Task Schedule library or method.

Hi all! I've searched a lot but I couldn't find a library that can put some tasks in order and each task can be set to execute exact amount of time. Every library I found do tasks with a number of iterations or repetitions but no one tracks time spent.

In short, a library should do:

  • Create task to execute for some time and maybe do another function on task's end
  • Put some tasks in order
  • Pause execution of following tasks when the previous task is active
  • Modify active task params
  • Optionally prioritize tasks

Something like this:

task.create(your_function, execute_time, priority, optional_params);

Thanks in advance!

At the beginning of loop{} check all the top priority functions if it's time to run, then call them. Jump back to the beginning of the loop. If no top priority functions need to run then check all the second priority functions and so on.

If you want to run a function or task for a fixed period of time? Read millis() at the beginning of the task execution and then read again at the end. If less than the desired time has elapsed the go back to the beginning, otherwise return to the main loop.