Timer switch (on and off)
in
Programming Questions
•
6 months ago
Hey there,
I'm trying to figure out how how create a timer which uses the millis() command and also has an on/off switch. So that i can trigger it to start and count time by doing X. Then get it to do something when it reaches a certain time (e.g. 5000 m/s, which I can already do). And then get it to stop and reset by doing Y.
Any ideas would be greatly appreciated :)
Thanks
This is all i have so far:
int ms;
void setup() {
size(400,400);
}
void draw() {
if (mousePressed == true) {
println("time: " + ms);
ms = millis(); }
if (ms > 5000) {
background(255,0,0,255);
}
}
1