Forum 2005-2010 (read only)
Syntax & Programs
(Read 355 times)
May 27, 2007, 11:31 am
Is there a way to measure microseconds? I want to find out the interval between certain events (in this case, bytes received by the arduino) and milliseconds is a bit too crude.
May 27, 2007, 06:19 pm
There is not a call for measuring microseconds.
You could use delayMicroseconds() and polling to repeatedly wait a while and check to get a rough idea of how long it was.
You could also look at TCNT1 which is a 16 bit register that increments every 4 microseconds in the standard Arduino configuration. It is going to roll over frequently, and you really should block interrupts around reads to it, like this...
myVar = TCNT1;
... which assumes you know interrupts were off when you started. (true for normal Arduino code).