Skip to content

Commit

Permalink
improving the example
Browse files Browse the repository at this point in the history
  • Loading branch information
andreagilardoni committed Aug 7, 2024
1 parent 98010c4 commit 06f704c
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions libraries/RTC/examples/Test_RTC/Test_RTC.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Test RTC
A test sketch showcasing all RTC showcasing various functionalities related to the RTC module,
A test sketch showcasing all RTC functionalities related to the RTC module,
including setting the time, handling interrupts, and reading time values.
Find the full UNO R4 WiFi RTC documentation here:
Expand Down Expand Up @@ -45,16 +45,10 @@ void setup() {
// Set a specific initial time (August 25, 2022, 14:37:00 Thursday)
RTCTime mytime(25, Month::AUGUST, 2022, 14, 37, 00, DayOfWeek::THURSDAY, SaveLight::SAVING_TIME_ACTIVE);

RTCTime savedTime;
RTC.getTime(savedTime);

// Set the initial time if RTC is not running
// Set the initial time if RTC is not running.
// The RTC may be still running if the board was reset, or if VRTC pin was powered
if (!RTC.isRunning()) {
if (savedTime.getYear() != 2000) {
RTC.setTime(mytime);
} else {
RTC.setTime(savedTime);
}
RTC.setTime(mytime);
}

// Create an alarm time set to 35 seconds
Expand Down Expand Up @@ -147,4 +141,4 @@ void loop() {

status = !status;
delay(1000);
}
}

0 comments on commit 06f704c

Please sign in to comment.