a problem with a simple timer / counter
in
Programming Questions
•
10 months ago
Hey there! This is a simple timer that counts in seconds infinately. The this is that when it comes to print the seconds on the panel, it does this but in "millis". How can I fix it and print the elapsed time in "seonds"?
here is the code:
int time;
int wait = 1000;
void setup(){
time = millis();//store the current time
}
void draw(){
//check the difference between now and the previously stored time is greater than the wait interval
if(millis() - time >= wait){
println(time);//if it is, do something
time = millis();//also update the stored time
}
}
any help would be much appreciated. :)
1