I included DS3231 library and wrote a code for trigerring relay, but got this error message.
If any one can help?
Regards
I wrote this code:
#include <DS3231.h>
int Relay = 4;
DS3231 rtc//(SDA, SCL);
Time t;
const int OnHour = 12;
const int OnMin = 24;
const int OffHour = 12;
const int OffMin = 25;
void setup() {
Serial.begin(115200);
rtc.begin();
// The following lines can be uncommented to set the date and time
rtc.setDOW(SUNDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(03, 30, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(10, 13, 2019); // Set the date to January 1st, 2014
pinMode(Relay, OUTPUT);
digitalWrite(Relay, LOW);
}
void loop() {
t = rtc.getTime();
Serial.print(t.hour);
Serial.print(" hour(s), ");
Serial.print(t.min);
Serial.print(" minute(s)");
Serial.println(" ");
delay (1000);
if(t.hour == OnHour && t.min == OnMin){
digitalWrite(Relay,HIGH);
Serial.println("LIGHT ON");
}
else if(t.hour == OffHour && t.min == OffMin){
digitalWrite(Relay,LOW);
Serial.println("LIGHT OFF");
}
}
Posted on 13-10-19.txt (1015 Bytes)