We saw that a timer is specified by two parameters: Its 'tick speed' in microseconds per tick, and how many ticks before it 'laps' or returns to zero.
A regular clock, for example, might tick once per second, and lap after twelve hours -- or in terms the begin() method understands: Tick once per 1,000,000 microseconds, and lap after 60*60*12 ticks.
// Hardware Timer sketch 2: Print a message every twelve hours precisely. // Even though interrupts are disabled and we need to be quick, we can // do (a modest amount of) printing inside a hardware timer handler, // because the print functions don't actually wait to perform the // output themselves, they just pass the data to the core software to // ship out when it can. void myTimerHandler() { println("another twelve hours"); } void setup() { Timer1.begin(1000000,60*60*12); // One second tick, 12 hour lap Timer1.setLapHandler(myTimerHandler); // Register a per-lap handler Timer1.start(); // And start the timer } void loop() { /* Nothing to do */ }