Go Down

Topic: millis() function (Read 1 time) previous topic - next topic

mirfeo

can anyone explain millis() function precisely?

AWOL

#1
Jun 30, 2011, 01:08 pm Last Edit: Jun 30, 2011, 01:12 pm by AWOL Reason: 1
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?
"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.

robtillaart


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.
Rob Tillaart

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

Go Up