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 1
1
/*
2
- Author: Adam Garbo
3
- Created: May 23rd , 2020
2
+ Author: Adam Garbo and Nathan Seidle
3
+ Created: June 3rd , 2020
4
4
License: MIT. See SparkFun Arduino Apollo3 Project for more information
5
5
6
6
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
-
13
7
*/
14
8
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
17
11
18
12
void setup ()
19
13
{
20
14
Serial.begin (115200 );
21
15
Serial.println (" SparkFun RTC Set UNIX Epoch Time Example" );
22
16
23
17
// 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
25
19
}
26
20
27
21
void loop ()
28
22
{
23
+ // Print UNIX Epoch timestamp
29
24
Serial.print (" Epoch time: " ); Serial.println (myRTC.getEpoch ());
25
+
26
+ // Print RTC's date and time
30
27
Serial.print (" Timestamp: " ); printDateTime ();
31
28
32
29
delay (1000 );
You can’t perform that action at this time.
0 commit comments