MrAlvin

arduino timed event

Mar 18th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. void is_it_time() {
  2.   static unsigned long previousMillis = 0;
  3.   static unsigned long interval = 500;
  4.   if (millis() - previousMillis > interval) {
  5.     previousMillis = millis();
  6.     // do you timed event
  7.   }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment