Let's Make Robots!

Arduino Measuring Time in Milliseconds

Greetings fellow robot builders,

I have used my Arduino so far with much succes but I cannot, for the life of me, find out how to measure the time from one point of the program to another in milliseconds. I have downloaded the Arduino "Time" library and it seems that that can only measure in whole seconds and as many of you know, a second is a very very long time in a program. By the way, I do not want the robot to pause in this time. (I know about the "delay" function)

Any help would be appreciated.

Thanks, Riddellikins

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You should really look at the blink without delay in the Example sketches. It will show you one way to do almost exactly what you are attempting to do.

I swear that didn't exist before now. It was on the Arduino website too.

Thanks guys, exactly what I wanted.

You could check out the millis and the micros functions.

basile

You don't need a special library. The millis timer keeps track of milliseconds since the current program started running.