Pages: [1]   Go Down
Author Topic: millis() function  (Read 1231 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can anyone explain millis() function precisely?
Logged

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

It returns the number of milliseconds (roughly) since the Arduino last reset.
It rolls over its 32 bit value after about 49 days. (232 1/1000ths of a second is 1 193 hours 2 minutes and 47.296 seconds)
What precisely do you want to know?
« Last Edit: June 30, 2011, 06:12:03 am by AWOL » 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.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 223
Posts: 13896
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


see - http://www.arduino.cc/en/Reference/Millis -

It has a small cousin - http://arduino.cc/en/Reference/Micros -

and it is part of the most famous Arduino tutorial - http://arduino.cc/en/Tutorial/BlinkWithoutDelay -

Note the return value is an unsigned long, and one should take care when comparing millis() often you should use  >=   or <=  to prevent missing "ticks" that can happen ewhen using  == .  Finally, allways use substractions like in the blinkWithoutDelay to be overflow proof.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: