delay(), elapsed time
in
Programming Questions
•
2 years ago
My timer is not working, is delay() the problem? or setup()?
If I put the timer code paragraph in draw() instead of setup() it works.
- void setup() {
size(120,120);
noLoop();
//
int time0=second()+60*(minute()+60*(hour()+24*day()));
println(time0);
delay(50000); // 5 seconds delay
int time1=second()+60*(minute()+60*(hour()+24*day()));
println (time1);
int elapsed=time1-time0;
println(elapsed);
//
} - void draw() {
}
1