diff --git a/DS1307.ino b/DS1307.ino deleted file mode 100644 index 3f04c87..0000000 --- a/DS1307.ino +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include - -RTC_DS1307 rtc; - -const int relay = A3; -bool on = LOW; -bool off = HIGH; - -void setup() { - Serial.begin(9600); - - if (!rtc.begin()) { - Serial.println("Couldn't find RTC"); - while (1); - } - - if (!rtc.isrunning()) { - Serial.println("RTC is not running, setting the time!"); - rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); - } - - pinMode(relay, OUTPUT); - digitalWrite(relay, off); -} - -void loop() { - DateTime now = rtc.now(); - int currentHour = now.hour(); - int currentMinute = now.minute(); - int currentSecond = now.second(); - - Serial.print("Current time: "); - Serial.println(now.timestamp()); - - if (currentHour == 17 && currentMinute == 40 && currentSecond == 0) { - digitalWrite(relay, on); - delay(1000); // Delay to ensure the relay is toggled only once - } - if (currentHour == 6 && currentMinute == 0 && currentSecond == 0) { - digitalWrite(relay, off); - delay(1000); // Delay to ensure the relay is toggled only once - } - - delay(1000); -}