File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
libraries/RTC/examples/Example4_Set_Epoch Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 11/*
2- Author: Adam Garbo
3- Created: May 23rd , 2020
2+ Author: Adam Garbo and Nathan Seidle
3+ Created: June 3rd , 2020
44 License: MIT. See SparkFun Arduino Apollo3 Project for more information
55
66 This example demonstrates how to set the RTC using UNIX Epoch time.
7-
8- Most SparkFun Artemis boards have the necessary external 32kHz crystal to
9- enable the RTC. If you are using the Artemis module bare you will either
10- need an external 32kHz xtal or use the internal LFRC. Read the datasheet
11- section 12.1 for more information.
12-
137*/
148
15- #include " RTC.h" // Include RTC library included with the Aruino_Apollo3 core
16- APM3_RTC myRTC; // Create instance of RTC class
9+ #include " RTC.h" // Include RTC library included with the Aruino_Apollo3 core
10+ APM3_RTC myRTC; // Create instance of RTC class
1711
1812void setup ()
1913{
2014 Serial.begin (115200 );
2115 Serial.println (" SparkFun RTC Set UNIX Epoch Time Example" );
2216
2317 // Set the RTC time using UNIX Epoch time
24- myRTC.setEpoch (1590240780 ); // E.g. Saturday, May 23 , 2020 1:33:00 PM
18+ myRTC.setEpoch (1591185600 ); // E.g. 12:00:00, June 3rd , 2020
2519}
2620
2721void loop ()
2822{
23+ // Print UNIX Epoch timestamp
2924 Serial.print (" Epoch time: " ); Serial.println (myRTC.getEpoch ());
25+
26+ // Print RTC's date and time
3027 Serial.print (" Timestamp: " ); printDateTime ();
3128
3229 delay (1000 );
You can’t perform that action at this time.
0 commit comments