Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is running? #6

Open
JoseCintra opened this issue Nov 26, 2017 · 1 comment
Open

Is running? #6

JoseCintra opened this issue Nov 26, 2017 · 1 comment

Comments

@JoseCintra
Copy link

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

@geologic
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants