Skip to content

Instantly share code, notes, and snippets.

@radames
Last active July 10, 2021 18:47
Show Gist options
  • Select an option

  • Save radames/03caf6af0aac2b2c30aa to your computer and use it in GitHub Desktop.

Select an option

Save radames/03caf6af0aac2b2c30aa to your computer and use it in GitHub Desktop.
Simple Arduino Hour Minute counter
long lastTime = 0;
long minutes = 0;
long hours = 0;
void setup() {
}
void loop() {
if(millis()-lastTime > 60000){
minutes++;
lastTime = millis();
}
if(minutes > 60){
hours++;
minutes = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment