1
1
/*
2
2
Test RTC
3
3
4
- A test sketch showcasing all RTC showcasing various functionalities related to the RTC module,
4
+ A test sketch showcasing all RTC functionalities related to the RTC module,
5
5
including setting the time, handling interrupts, and reading time values.
6
6
7
7
Find the full UNO R4 WiFi RTC documentation here:
@@ -45,16 +45,10 @@ void setup() {
45
45
// Set a specific initial time (August 25, 2022, 14:37:00 Thursday)
46
46
RTCTime mytime (25 , Month::AUGUST, 2022 , 14 , 37 , 00 , DayOfWeek::THURSDAY, SaveLight::SAVING_TIME_ACTIVE);
47
47
48
- RTCTime savedTime;
49
- RTC.getTime (savedTime);
50
-
51
- // Set the initial time if RTC is not running
48
+ // Set the initial time if RTC is not running.
49
+ // The RTC may be still running if the board was reset, or if VRTC pin was powered
52
50
if (!RTC.isRunning ()) {
53
- if (savedTime.getYear () != 2000 ) {
54
- RTC.setTime (mytime);
55
- } else {
56
- RTC.setTime (savedTime);
57
- }
51
+ RTC.setTime (mytime);
58
52
}
59
53
60
54
// Create an alarm time set to 35 seconds
@@ -147,4 +141,4 @@ void loop() {
147
141
148
142
status = !status;
149
143
delay (1000 );
150
- }
144
+ }
0 commit comments