Skip to content
This repository was archived by the owner on Oct 18, 2021. It is now read-only.

Commit 0150e1f

Browse files
only check rtc.lostPower() in setup()
1 parent 41b11ec commit 0150e1f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

‎lightmeter.ino‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ void setup()
6767
extra::signal_led(5);
6868
}
6969
}
70+
71+
//CHECK IF RTC LOST POWER AND TIME IS INVALID
72+
if(rtc.lostPower())
73+
{
74+
while(1)
75+
{
76+
extra::signal_led(7);
77+
}
78+
}
7079

7180
//update filePath to point to file_name.file_extenion.
7281
filePath = FILE_NAME + FILE_EXTENSION;
@@ -98,14 +107,6 @@ void setup()
98107
/* MAIN LOOP */
99108
void loop()
100109
{
101-
if(rtc.lostPower()) //check if RTC lost power and time is wiped
102-
{
103-
while(1)
104-
{
105-
extra::signal_led(7);
106-
}
107-
}
108-
109110
float lux = lightsensor.luxRead();
110111
byte tries = 0; //counter for tries
111112

0 commit comments

Comments
 (0)