Skip to content

Commit 55571c5

Browse files
committed
Update Example6_Rolling_Alarms.ino
1 parent 41e2914 commit 55571c5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

libraries/RTC/examples/Example6_Rolling_Alarms/Example6_Rolling_Alarms.ino

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
APM3_RTC myRTC; //Create instance of RTC class
1111

1212
volatile bool alarmFlag = false;
13+
int alarmSeconds = 5;
14+
int alarmMinutes = 0;
15+
int alarmHours = 0;
16+
int alarmDays = 0;
17+
int alarmMonths = 0;
18+
1319

1420
void setup()
1521
{
@@ -51,8 +57,11 @@ void loop()
5157
alarmFlag = false;
5258

5359
// Set the RTC's rolling alarm
54-
myRTC.setAlarm(0, (myRTC.seconds + 5) % 60, myRTC.minute,
55-
myRTC.hour, myRTC.dayOfMonth, myRTC.month);
60+
myRTC.setAlarm(0, (myRTC.seconds + alarmSeconds) % 60,
61+
(myRTC.minute + alarmMinutes) % 60,
62+
(myRTC.hour + alarmHours) % 24,
63+
(myRTC.dayOfMonth + alarmDay) % 31, // To do: How to # days in a month rollovers
64+
(myRTC.month + alarmMonth) % 12);
5665
myRTC.setAlarmMode(6);
5766
Serial.print("Rolling alarm: "); printAlarm();
5867
}

0 commit comments

Comments
 (0)