Guest User

Untitled

a guest
Dec 29th, 2013
11
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. long previousSecond = 0;
  2.  
  3. /***********************************************
  4.    pulse
  5.    Set a var to 1 each second.
  6.    Input : n/a
  7.    Output : n/a
  8.    Note : you need to declare a "int second = 0" var in main pde file
  9. ***********************************************/
  10.  
  11. void pulse() {
  12.     if (abs(millis() - previousSecond) > 1000) {
  13.         second = 1;
  14.         previousSecond = millis();
  15.     }
  16.     else {
  17.         second = 0;
  18.     }
  19. }
RAW Paste Data