Skip to content

Commit 3115ab5

Browse files
committed
Merge from arduion-libraries/RTCZero
2 parents 7851b87 + d67cdb1 commit 3115ab5

File tree

7 files changed

+184
-129
lines changed

7 files changed

+184
-129
lines changed

examples/SimpleRTC/SimpleRTC.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
88
http://arduino.cc/en/Tutorial/SimpleRTC
99
10+
created by Arturo Guadalupi <[email protected]>
11+
15 Jun 2015
12+
13+
modified
14+
21 Oct 2015
1015
*/
1116

1217
#include <RTCZero.h>
@@ -28,7 +33,7 @@ void setup()
2833
{
2934
Serial.begin(9600);
3035

31-
rtc.begin(H24); // initialize RTC 24H format. The dual option is H12
36+
rtc.begin(); // initialize RTC
3237

3338
// Set the time
3439
rtc.setHours(hours);
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
Simple RTC Alarm for Arduino Zero
3+
4+
Demonstrates the use of alarms using the RTC library for the Arduino Zero
5+
6+
This example code is in the public domain
7+
8+
http://arduino.cc/en/Tutorial/SimpleRTCAlarm
9+
10+
created by Arturo Guadalupi <[email protected]>
11+
25 Sept 2015
12+
13+
modified
14+
21 Oct 2015
15+
*/
16+
17+
#include <RTCZero.h>
18+
19+
/* Create an rtc object */
20+
RTCZero rtc;
21+
22+
/* Change these values to set the current initial time */
23+
const uint8_t seconds = 0;
24+
const uint8_t minutes = 0;
25+
const uint8_t hours = 16;
26+
27+
/* Change these values to set the current initial date */
28+
const uint8_t day = 25;
29+
const uint8_t month = 9;
30+
const uint8_t year = 15;
31+
32+
void setup()
33+
{
34+
Serial.begin(9600);
35+
36+
rtc.begin(); // initialize RTC 24H format
37+
38+
rtc.setTime(hours, minutes, seconds);
39+
rtc.setDate(day, month, year);
40+
41+
rtc.setAlarmTime(16, 0, 10);
42+
rtc.enableAlarm(rtc.MATCH_HHMMSS);
43+
44+
rtc.attachInterrupt(alarmMatch);
45+
}
46+
47+
void loop()
48+
{
49+
50+
}
51+
52+
void alarmMatch()
53+
{
54+
Serial.println("Alarm Match!");
55+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Simple RTC Alarm for Arduino Zero
3+
4+
Demonstrates the use an alarm to wake up an Arduino zero from Standby mode
5+
6+
This example code is in the public domain
7+
8+
http://arduino.cc/en/Tutorial/SleepRTCAlarm
9+
10+
created by Arturo Guadalupi
11+
17 Nov 2015
12+
*/
13+
14+
#include <RTCZero.h>
15+
16+
/* Create an rtc object */
17+
RTCZero rtc;
18+
19+
/* Change these values to set the current initial time */
20+
const uint8_t seconds = 0;
21+
const uint8_t minutes = 00;
22+
const uint8_t hours = 17;
23+
24+
/* Change these values to set the current initial date */
25+
const uint8_t day = 17;
26+
const uint8_t month = 11;
27+
const uint8_t year = 15;
28+
29+
void setup()
30+
{
31+
Serial.begin(115200);
32+
33+
rtc.begin();
34+
35+
rtc.setTime(hours, minutes, seconds);
36+
rtc.setDate(day, month, year);
37+
38+
rtc.setAlarmTime(17, 00, 10);
39+
rtc.enableAlarm(rtc.MATCH_HHMMSS);
40+
41+
rtc.attachInterrupt(alarmMatch);
42+
43+
rtc.standbyMode();
44+
}
45+
46+
void loop()
47+
{
48+
49+
Serial.println("Awake!");
50+
51+
for (int i = 0; i < 10; i++)
52+
Serial.print(i);
53+
54+
Serial.println();
55+
56+
Serial.println("Done! Goodnight!");
57+
58+
rtc.standbyMode(); // Sleep until next alarm match
59+
}
60+
61+
void alarmMatch()
62+
{
63+
64+
}

keywords.txt

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,43 @@ RTCZero KEYWORD1
1212
# Methods and Functions (KEYWORD2)
1313
#######################################
1414

15-
getDay KEYWORD2
16-
getMonth KEYWORD2
17-
getYear KEYWORD2
18-
getHours KEYWORD2
19-
getMinutes KEYWORD2
20-
getSeconds KEYWORD2
15+
getDay KEYWORD2
16+
getMonth KEYWORD2
17+
getYear KEYWORD2
18+
getHours KEYWORD2
19+
getMinutes KEYWORD2
20+
getSeconds KEYWORD2
2121

22-
setDay KEYWORD2
23-
setMonth KEYWORD2
24-
setYear KEYWORD2
25-
setHours KEYWORD2
26-
setMinutes KEYWORD2
27-
setSeconds KEYWORD2
22+
setDay KEYWORD2
23+
setMonth KEYWORD2
24+
setYear KEYWORD2
25+
setHours KEYWORD2
26+
setMinutes KEYWORD2
27+
setSeconds KEYWORD2
28+
setDate KEYWORD2
29+
setTime KEYWORD2
30+
31+
getAlarmDay KEYWORD2
32+
getAlarmMonth KEYWORD2
33+
getAlarmYear KEYWORD2
34+
getAlarmHours KEYWORD2
35+
getAlarmMinutes KEYWORD2
36+
getAlarmSeconds KEYWORD2
37+
38+
setAlarmDay KEYWORD2
39+
setAlarmMonth KEYWORD2
40+
setAlarmYear KEYWORD2
41+
setAlarmHours KEYWORD2
42+
setAlarmMinutes KEYWORD2
43+
setAlarmSeconds KEYWORD2
44+
setAlarmDate KEYWORD2
45+
setAlarmTime KEYWORD2
46+
47+
enableAlarm KEYWORD2
48+
disableAlarm KEYWORD2
49+
50+
standbyMode KEYWORD2
2851

2952
#######################################
3053
# Constants (LITERAL1)
3154
#######################################
32-
H24 LITERAL1
33-
H12 LITERAL1
34-

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=RTCZero
2-
version=1.0.0
2+
version=1.3.0
33
author=Arduino
44
maintainer=Arduino <[email protected]>
55
sentence=Allows to use the RTC functionalities. For Arduino Zero only.

0 commit comments

Comments
 (0)