This library is based on Paul Stoffregen's TimerOne library that provide ability to add more than one callback, which I called "task"
To use this library, you'll need to install Paul Stoffregen's TimerOne as well:
https://github.com/PaulStoffregen/TimerOne
msTask fooTask(1000, Foo);
msTask barTask(5000, Bar);-
The first parameter is task's period
-
The second is the callback function:
void Foo(){
//your Foo task's code here
}
void Bar(){
//your Bar task's code here
}This function must be call in setup() once
msTask::init();fooTask.stop();fooTask.start();fooTask.setPeriod(500);fooTask.setCallback(Bar);You can read example Blink+AnalogRead, FlashLED or TrafficLight to know how to use.