Pages: [1]   Go Down
Author Topic: For how long a funcion is running in arduino.  (Read 555 times)
0 Members and 1 Guest are viewing this topic.
Greece>Crete>Heraklion
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Imagination is everything....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 613
Posts: 49335
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26290
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unless it's a really complicated one. or it involves serial comms, I'd use "micros ()"
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: