We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Too much millis (Read 774 times)
Too much millis
Apr 15th, 2010, 7:47am
 
Hi all.
Im looking for a answer to my problem..
When i run this code, the println make a lot of 0s, 1s, 2s, 3s,.....and i only need one 0, one 1, one 2, one 3, .....

I try with frameRate, but dont interess me decress the frameRate

Any ideas?

void draw() {
 int m = millis();
println(m/1000);
}


thanks
Re: Too much millis
Reply #1 - Apr 15th, 2010, 8:02am
 
Canonical:
Code:
int pm = 0;

void draw()
{
if (millis() - pm > 1000)
{
pm = millis();
println(pm/1000);
}
}
Re: Too much millis
Reply #2 - Apr 15th, 2010, 8:52am
 
Thanks...

Now i undestand.

processing have some command like "bang" or "toogle" in PD.

like: when something happen, shot a message...?

Thanks once again
Re: Too much millis
Reply #3 - Apr 15th, 2010, 9:44am
 
println() to output to console in PDE (as I shown).
text() if you want to display on screen.
Page Index Toggle Pages: 1