1

I try to change time on windows to test my programing condition but RTC usually keep old time when i change time on windows and re-upload the code . I'm also removing the battery and cut the power it is still not working.

here is my set up and library is https://github.com/adafruit/RTClib

void setup () {

#ifndef ESP8266 while (!Serial); // for Leonardo/Micro/Zero #endif

Serial.begin(9600); Serial.println("ESP start..."); pinMode(Ledpin, OUTPUT); pinMode(buzzer, OUTPUT); digitalWrite(buzzer, HIGH);

delay(3000); // wait for console opening

if (! rtc.begin()) { Serial.println("Couldn't find RTC"); while (1); }

if (rtc.lostPower()) { Serial.println("RTC lost power, lets set the time!"); // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(DATE), F(TIME))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); }

}

Otaku ICT
  • 11
  • 1

0 Answers0