Skip to content

Instantly share code, notes, and snippets.

@davisford
Created August 8, 2011 17:04
Show Gist options
  • Save davisford/1132198 to your computer and use it in GitHub Desktop.
Save davisford/1132198 to your computer and use it in GitHub Desktop.
Hygro Petal => Just main loop and timeout
// ------------------ 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