Arduino Forum

Forum 2005-2010 (read only) => Software => Syntax & Programs => Topic started by: ^Mr.Rat^ on May 30, 2010, 08:34 pm

Title: For how long a funcion is running in arduino.
Post by: ^Mr.Rat^ on May 30, 2010, 08:34 pm
Hi i have an arduino duemilanove and i want to see for how long a function is running in ms .
Can this happen?and how?
Title: Re: For how long a funcion is running in arduino.
Post by: PaulS on May 30, 2010, 08:49 pm
Call millis() before the function. Call it again after the function ends. The difference in values is the length of time the function to execute, in milliseconds.
Title: Re: For how long a funcion is running in arduino.
Post by: AWOL on May 30, 2010, 09:21 pm
Unless it's a really complicated one. or it involves serial comms, I'd use "micros ()"