forked from ldv46/Lichtschakelsysteem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRTC.h
32 lines (31 loc) · 1.32 KB
/
RTC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
void RTCopstart(){
setSyncProvider(RTC.get); // the function to get the time from the RTC
if(timeStatus() != timeSet){
LED('Y');
delay(1000);
tijdcheck = 0;
Serial.println("RTC niet gevonden");
} else {
tijdcheck = 1;
Serial.println("RTC tijd:");
if(hour() < 10)Serial.print("0");Serial.print(hour()); Serial.print(":");if(minute() < 10)Serial.print("0");Serial.print(minute());Serial.print(":");if(second() < 10)Serial.print("0");Serial.print(second());
Serial.print(" ");
Serial.print(day());Serial.print("/");Serial.print(month());Serial.print("/");Serial.println(year());
}
}
void Boilercheck(){
if(hour() < boileruit && hour() >= boileraan && boilerstatus == 0 && boileraltijduit == 0){
boilerstatus = 1;
eepromwl.write(13, boilerstatus);
delay(1000); //delay voor veiligheid in geval van fout in bovenstaande loop
}else if((hour() >= boileruit || hour() < boileraan) && boilerstatus == 1 && boileraltijdaan == 0){
boilerstatus = 0;
eepromwl.write(13, boilerstatus);
delay(1000); //delay voor veiligheid in geval van fout in bovenstaande loop
}else if(boilerstatus == 0 && boileraltijdaan == 1){
boilerstatus = 1;
eepromwl.write(13, boilerstatus);
delay(1000); //delay voor veiligheid in geval van fout in bovenstaande loop
}
digitalWrite(8, boilerstatus);
}