DS3231_Simple icon indicating copy to clipboard operation
DS3231_Simple copied to clipboard

Is running?

Open JoseCintra opened this issue 7 years ago • 1 comments
trafficstars

Hi! Which method should I use to know:

  1. first time i ran and the device wasn't running yet
  2. the battery on the device is low or even missing Some libraries have the method "isrunning" or "lostPower"...

Thanks

JoseCintra avatar Nov 26 '17 23:11 JoseCintra

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);  
  }

geologic avatar Dec 14 '17 13:12 geologic