Created
November 24, 2013 02:06
-
-
Save shiffman/7622450 to your computer and use it in GitHub Desktop.
Triggering events based on time.
This file contains hidden or 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
int state = 0; | |
int time1 = 2000; | |
int time2 = 5000; | |
void setup() { | |
} | |
void draw() { | |
int now = millis(); | |
if (now > time1 && state == 0) { | |
// trigger event 1 | |
println("EVENT 1 " + now); | |
state = 1; | |
} else if (now > time2 && state == 1) { | |
// trigger event 2 | |
println("EVENT 2 " + now); | |
state = 2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment