3
3
Created: June 3rd, 2020
4
4
License: MIT. See SparkFun Arduino Apollo3 Project for more information
5
5
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.
10
15
*/
11
16
12
17
#include " RTC.h" // Include RTC library included with the Aruino_Apollo3 core
@@ -31,13 +36,13 @@ void setup()
31
36
// Set the RTC alarm mode
32
37
/*
33
38
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)
41
46
*/
42
47
myRTC.setAlarmMode (6 ); // Set the RTC alarm to match on minutes rollover
43
48
myRTC.attachInterrupt (); // Attach RTC alarm interrupt
0 commit comments