Created
August 8, 2011 17:04
-
-
Save davisford/1132198 to your computer and use it in GitHub Desktop.
Hygro Petal => Just main loop and timeout
This file contains 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
// ------------------ M A I N ( ) -------------------------------------------- | |
// Timeout handling | |
long timeoutInterval = 2000; // 2 seconds | |
long previousMillis = 0; | |
int counter = 0; | |
void timeout() | |
{ | |
// add code in here you want to | |
// execute every timeoutInterval seconds | |
} | |
void loop() | |
{ | |
// handle timeout function, if any | |
if ( millis() - previousMillis > timeoutInterval ) | |
{ | |
timeout(); | |
previousMillis = millis(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment