33 Created: June 3rd, 2020
44 License: MIT. See SparkFun Arduino Apollo3 Project for more information
55
6- This example demonstrates how to read and set the RTC alarms. The code is
7- configured so that the RTC alarm will trigger every minute. The RTC interrupt
8- service routine will set an alarm flag each time the alarm triggers and the
9- RTC date and time will printed to the Serial Monitor.
6+ This example demonstrates how to read and set the RTC alarms.
7+
8+ It is necessary to first set the RTC alarm date and time and then specify
9+ the alarm mode, which determines which date and time values will be used
10+ for comparison when generating an alarm interrupt.
11+
12+ The code is configured so that the RTC alarm will trigger every minute.
13+ The RTC interrupt service routine will set an alarm flag each time the
14+ alarm triggers and the RTC date and time will printed to the Serial Monitor.
1015*/
1116
1217#include " RTC.h" // Include RTC library included with the Aruino_Apollo3 core
@@ -31,13 +36,13 @@ void setup()
3136 // Set the RTC alarm mode
3237 /*
3338 0: Alarm interrupt disabled
34- 1: Alarm match every year
35- 2: Alarm match every month
36- 3: Alarm match every week
37- 4: Alarm match every day
38- 5: Alarm match every hour
39- 6: Alarm match every minute
40- 7: Alarm match every second
39+ 1: Alarm match every year (hundredths, seconds, minutes, hour, day, month)
40+ 2: Alarm match every month (hundredths, seconds, minutes, hours, day)
41+ 3: Alarm match every week (hundredths, seconds, minutes, hours, weekday)
42+ 4: Alarm match every day (hundredths, seconds, minute, hours)
43+ 5: Alarm match every hour (hundredths, seconds, minutes)
44+ 6: Alarm match every minute (hundredths, seconds)
45+ 7: Alarm match every second (hundredths)
4146 */
4247 myRTC.setAlarmMode (6 ); // Set the RTC alarm to match on minutes rollover
4348 myRTC.attachInterrupt (); // Attach RTC alarm interrupt
0 commit comments