Skip to content

Instantly share code, notes, and snippets.

@staceymakes
Created December 22, 2014 02:20
Show Gist options
  • Save staceymakes/aa9d3426d35a09ef3918 to your computer and use it in GitHub Desktop.
Save staceymakes/aa9d3426d35a09ef3918 to your computer and use it in GitHub Desktop.
Arduino Avoid Delay
unsigned long interval=50; // the time we need to wait
unsigned long previousMillis=0;
void setup(){
}
void loop(){
if ((unsigned long)(millis() - previousMillis) >= interval) {
previousMillis = millis();
//go ahead and do what you need
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment