#include "MyTimer.h"
MyTimer timer;
void setup() {
Serial.begin(9600);
timer.setCallback(cb);//To set the callback for timeout
timer.setOnTickCallback(Ticks); //To set the the callback for each ticks
timer.setTimeout(Time(5)); //To set the interval
//timer.setTimeout(Time(5)); // Sets to 5 seconds
//timer.setTimeout(Time(5,2)); // Sets to 2 minutes 5 seconds
//timer.setTimeout(Time(5,2,1)); // Sets to 1 hour 2 minutes 5seconds
//timer.setTimeout(200); // Sets to 200 milliseconds
}
void loop() {
timer.run();
}
void cb(){
Serial.println("CallBack");
timer.reset();//To restart the timer
}
void Ticks(long ticks){ // Number of ticks is returned to the parameter
Serial.println("Tick "+ String(ticks));
}