Hi,
just struggeled to use the TimeAlarms Library in one of my projects. I read a lot about this Lib and are aware that if the delay function is used, it has to be changed to Alarms.delay. So far so good, but my sketch didn't activate the specified alarms.
For troubleshooting have tried to minimise the code as far as possible in using the standard TimeAlarms Library example but still minimised:
#include <Time.h>
#include <TimeAlarms.h>
void setup()
{
Serial.begin(9600);
setTime(8,29,0,1,1,11); // set time to Saturday 8:29:00am Jan 1 2011
Alarm.timerRepeat(15, Repeats); // timer for every 15 seconds
}
void loop(){
// digitalClockDisplay(); // don't need
// Alarm.delay(1000); // wait one second between clock display
}
void Repeats(){
Serial.println("15 second timer");
}
I have nothing in the loop section (which should be fine) and was waiting for the serial output, but it failed !
Then I reactivated the Alarm.delay command and it worked.
Even if I use a minimum Alarm.delay(0) it still works !
In my real project, there is a lot of code in the loop section, but there was nowhere Alarm.delay specified.
Including it now, the Alarms working fine.