if i want to run functions only sometimes, but not other times - do i set them up like this:
void warmLogic()
{
timer.disable (coolLogicTimer); //turns off the other timer
do things; // read temps, send to Blynk, open vents etc
timer.enable (warmLogicTimer); // enables the 3 min timer to run this function every 3 mins
}
void coolLogic()
{
timer.disable (warmLogicTimer); //turns off the other timer
dothings; // read temps, send to Blynk, open vents etc
timer.enable (coolLogicTimer); // enables the 3 min timer to run this function every 3 mins
}
void setup()
{
warmLogicTimer = timer.setTimeout(3L * 60000L, warmLogic);
coolLogicTimer = timer.setTimeout(3L * 60000L, coolLogic);
}
Yes that looks about right except you probably can’t enable a timer that is already enabled or disable a timer that isn’t enabled.
What I mean by this is you would need to enable or disable the timers in setup and ensure you know the sequence of which event will take place first in your sketch warmLogic or coolLogic.
You can enable/disable timers everywhere. It’s no problem at all. I use this stuff all the time to set different timers and enable/disable them
The SimpleTimer library also has functions to see wether a timer is enabled or disabled, if you want to know for sure. The reference on arduino.cc is quite elaborate.
Yes enable starts the timer countdown. You can have more than 10 timers but you need a second instance (new timer name) for the second set of 10 timers.