One thing that confuses many new users is that the same timer object can support up to 16 timers (or 12 if you’re using SimpleTimer) this means that you can do this:
void setup()
{
timer.setInterval(5000L, take_sensor_reading); // call the take_sensor_reading() function every 5 seconds
timer.setInterval(30000L, control_heater); // call the control_heater () function every 30 seconds
timer.setInterval(7200000L, once_every_2_hours); // call the once_every_2_hours () function every 7200 seconds
}
You can see that the same timer
object is being used for each of these timers. There is no need to declare multiple timer objects with a different names unless you have more than 16 timers (or 12 with SimpleTimer).