Open Eheran1 opened 6 years ago
I'm Sorry that I can't anything to this post because I'm new at this and having ALOT of trouble finding simple examples or anyone knowing how to set a simple alarm. Everyone can tell me how to set the ds3231 clock, but not how to make a pin go high at 3;30 every Wednesday. Very frustrating. I have a watch for telling time, Hope the ds3231 can do more than that.
This example really did not help you?
// Set Alarm - 10h:45m:30s in every Friday (1 - Mon, 7 - Sun)
// setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
// clock.setAlarm1(5, 10, 40, 30, DS3231_MATCH_DY_H_M_S);
By the way, since this library is not maintaned i switched to https://github.com/JChristensen/DS3232RTC. But doing a alarm is actually a little harder with that one as well as printing the time... so if there is no need maybe stick with this one? I dont know how to set a day of the week there, but this is every second + Pin high. I think you have to call "RTC.alarm(ALARM_1);" every time you want the pin to go low again. But maybe that is just for the "software" flag that there has been a alarm. There is no need to use the pin as long as you can communicate, you still see the alarms, you only really need the pin for wakeup etc.
RTC.setAlarm(ALM1_EVERY_SECOND, 0, 0, 0, 1); //daydate parameter should be between 1 and 7
RTC.alarm(ALARM_1); //ensure RTC interrupt flag is cleared
RTC.alarmInterrupt(ALARM_1, true); //pin goes high
Software check (and clear flag) if alarm happened:
if (RTC.alarm(ALARM_1)) {
}
This is out of the "alarm" example and will not work, see below for the working example. It took me way too long to figure that one out: There can not be any seconds with Alarm2.