Inspired by a question about resetting millis() on the forum today I developped a simple StopWatch Class. As it is a Class one can instantiate standalone stopwatches or an array of them. As it is based upon millis() it inherits some of its behavior...
The class has 5 functions and a constructor:
StopWatch(); // constructor
void start(); // start / continue the measurement
void stop(); // stops the measurement
long reset(); // reset the measurement (can't continue)
unsigned long value(); // elapsed time since start (leaptime)
bool isRunning(); // current state of the stopwatch
Have a look at - Arduino Playground - StopWatchClass - for the details.
Suggestions, improvements and other comments ? let me know : enjoy tinkering
Rob