Created
March 24, 2026 18:48
-
-
Save indefinit/fb095dddd28ca37cf7d004393c227f8d to your computer and use it in GitHub Desktop.
Arduino seconds counter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unsigned long lastTime = 0; | |
| int seconds = 0; | |
| void setup() { | |
| Serial.begin(9600); | |
| } | |
| void loop() { | |
| if (millis() - lastTime >= 1000) { | |
| seconds++; | |
| lastTime = millis(); | |
| Serial.println(seconds); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment