JChristensen / DS3232RTC

Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks
GNU General Public License v3.0
392 stars 135 forks source link

Alarm1 not working with ALM1_MATCH_HOURS but Alarm2 is #62

Closed toogooda closed 5 years ago

toogooda commented 5 years ago

Hi I used the Serial example and altered it so I could wake the Arduino from sleep. I need two alarms per day so thought the build in alarms will be perfect!

It also works without issue on Alarm2 but completly ignors Alarm 1 I see in your documentation that they differ in how they match to Hours and Mins but I have tried everything and can't work out why Alarm1 does not fire. Any ideas?

byte h = time/60; byte m = time - (h*60); ... if (aNum == 1){ //myAlarms.Alarm1 = time; RTC.setAlarm(ALM1_MATCH_HOURS, 0, m, h, 0); // daydate parameter should be between 1 and 7 RTC.alarm(ALARM_1); // ensure RTC interrupt flag is cleared RTC.alarmInterrupt(ALARM_1, true); //Serial.println("Alarm1"); }else{ //myAlarms.Alarm2 = time; RTC.setAlarm(ALM2_MATCH_HOURS, 0, m, h, 0); // daydate parameter should be between 1 and 7 RTC.alarm(ALARM_2); // ensure RTC interrupt flag is cleared RTC.alarmInterrupt(ALARM_2, true); //Serial.println("Alarm2"); }

If I can't resolve it a can just keep setting the second alarm but it would be an ugly work around.

Thanks in advance for your help.

JChristensen commented 5 years ago

Hello, if you believe this to be a problem with the library, please provide a SSCCE and also please be explicit about what the code is expected to do, and what it actually does.

toogooda commented 5 years ago

Hello, if you believe this to be a problem with the library, please provide a SSCCE and also please be explicit about what the code is expected to do, and what it actually does.

OK I will change your example one to use ALM1_MATCH_HOURS and show only Alarm2 Fires

JChristensen commented 5 years ago

Nothing heard, closing issue.