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
Time Delay (Read 914 times)
Time Delay
Nov 30th, 2009, 9:21pm
 
Hello All,

Looking for a way to make a timer. Basically, I'm looking to deactivate a function in the code after a certain amount of time has been reached since activation.

Is calling millis(); twice and finding the difference the easiest way about this?
Re: Time Delay
Reply #1 - Nov 30th, 2009, 11:46pm
 
you actually only have to call it once as millis returns the milliseconds after the start. so if you write if(millis()<10000)function();
you function only works in the first 10 seconds and will be "deactivated" after that.

if you search for timer you will find alot of other different timers but this should do what you need
Page Index Toggle Pages: 1