Skip to content

Commit ca602fe

Browse files
committed
Update Example1_Get_Time.ino
1 parent ac0bcd0 commit ca602fe

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

libraries/RTC/examples/Example1_Get_Time/Example1_Get_Time.ino

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
/* Author: Nathan Seidle
1+
/*
2+
Author: Nathan Seidle
23
Created: Septempter 27th, 2019
34
License: MIT. See SparkFun Arduino Apollo3 Project for more information
45
5-
This example demonstrates how to initialize and read from the on board RTC.
6+
This example demonstrates how to initialize and read from the on-board RTC.
7+
68
Most SparkFun Artemis boards have the necessary external 32kHz crystal to
79
enable the RTC. If you are using the Artemis module bare you will either
810
need an external 32kHz xtal or use the internal LFRC. Read the datasheet
@@ -11,16 +13,19 @@
1113
This example is based on the Ambiq SDK EVB2 RTC example.
1214
*/
1315

14-
#include "RTC.h" //Include RTC library included with the Aruino_Apollo3 core
15-
APM3_RTC myRTC; //Create instance of RTC class
16+
#include "RTC.h" // Include RTC library included with the Aruino_Apollo3 core
17+
APM3_RTC myRTC; // Create instance of RTC class
1618

1719
void setup()
1820
{
1921
Serial.begin(115200);
2022
Serial.println("SparkFun RTC Example");
2123

22-
myRTC.setToCompilerTime(); //Easily set RTC using the system __DATE__ and __TIME__ macros from compiler
23-
//myRTC.setTime(0, 51, 28, 7, 21, 10, 15); //Manually set RTC back to the future: Oct 21st, 2015 at 7:28.51 AM
24+
// Easily set RTC using the system __DATE__ and __TIME__ macros from compiler
25+
myRTC.setToCompilerTime();
26+
27+
// Manually set RTC date and time
28+
//myRTC.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy)
2429
}
2530

2631
void loop()
@@ -33,9 +38,9 @@ void loop()
3338
Serial.printf("%02d.", myRTC.seconds);
3439
Serial.printf("%02d", myRTC.hundredths);
3540

36-
Serial.printf(" %02d/", myRTC.month);
37-
Serial.printf("%02d/", myRTC.dayOfMonth);
38-
Serial.printf("%02d", myRTC.year);
41+
Serial.printf(" 20%d/", myRTC.year);
42+
Serial.printf("%02d/", myRTC.month);
43+
Serial.printf("%02d", myRTC.dayOfMonth);
3944

4045
Serial.printf(" Day of week: %d =", myRTC.weekday);
4146
Serial.printf(" %s", myRTC.textWeekday);

0 commit comments

Comments
 (0)