2011-10-09 16:21:55 -04:00
|
|
|
#ifndef StopWatch_h
|
|
|
|
#define StopWatch_h
|
2013-08-17 12:38:38 -04:00
|
|
|
//
|
2011-10-09 16:21:55 -04:00
|
|
|
// FILE: StopWatch.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: Simple StopWatch library for Arduino
|
|
|
|
// HISTORY: See StopWatch.cpp
|
|
|
|
// URL: http://www.arduino.cc/playground/Code/StopWatchClass
|
|
|
|
//
|
2013-08-17 12:38:38 -04:00
|
|
|
// Released to the public domain
|
2011-10-09 16:21:55 -04:00
|
|
|
//
|
|
|
|
|
|
|
|
|
2013-08-17 12:38:38 -04:00
|
|
|
#define STOPWATCH_LIB_VERSION "0.1.02"
|
|
|
|
|
|
|
|
#define STOPWATCH_RESET 0
|
|
|
|
#define STOPWATCH_RUNNING 1
|
|
|
|
#define STOPWATCH_STOPPED 2
|
2011-10-09 16:21:55 -04:00
|
|
|
|
2013-08-17 12:38:38 -04:00
|
|
|
class StopWatch
|
2011-10-09 16:21:55 -04:00
|
|
|
{
|
|
|
|
public:
|
2013-08-17 12:38:38 -04:00
|
|
|
StopWatch();
|
|
|
|
void start();
|
|
|
|
void stop();
|
|
|
|
void reset();
|
|
|
|
unsigned long value();
|
|
|
|
bool isRunning();
|
|
|
|
int state();
|
2011-10-09 16:21:55 -04:00
|
|
|
|
|
|
|
private:
|
2013-08-17 12:38:38 -04:00
|
|
|
int _state;
|
|
|
|
unsigned long _starttime;
|
|
|
|
unsigned long _stoptime;
|
2011-10-09 16:21:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// END OF FILE
|