DS3231_Simple
DS3231_Simple copied to clipboard
Is running?
trafficstars
Hi! Which method should I use to know:
- first time i ran and the device wasn't running yet
- the battery on the device is low or even missing Some libraries have the method "isrunning" or "lostPower"...
Thanks
For the 1) question: check year, if it is 00, it was powered for the first time:
DateTime MyTimestamp;
MyTimestamp = Clock.read();
if (MyTimestamp.Year==00) {
Clock.promptForTimeAndDate(Serial);
} else {
Serial.print(F(" * RTC time: "));
Clock.printTo(Serial);
}