Stopwatch library with start, stop, and getTime functions. Returns a 00:00:00 in MM:SS:MS format with a max duration of ~30min per documentation on the Timer class. Can easily be output through an LCD/TFT with printf(stopwatch.getTime());
Fork of Stopwatch by
Stopwatch.h@0:3328857bf625, 2012-07-16 (annotated)
- Committer:
- mdomino
- Date:
- Mon Jul 16 19:46:34 2012 +0000
- Revision:
- 0:3328857bf625
- Child:
- 2:2202f5336acb
Stopwatch library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mdomino | 0:3328857bf625 | 1 | #include "stdio.h" |
mdomino | 0:3328857bf625 | 2 | #include "stdlib.h" |
mdomino | 0:3328857bf625 | 3 | #include "math.h" |
mdomino | 0:3328857bf625 | 4 | #include "mbed.h" |
mdomino | 0:3328857bf625 | 5 | |
mdomino | 0:3328857bf625 | 6 | class Stopwatch { |
mdomino | 0:3328857bf625 | 7 | public: |
mdomino | 0:3328857bf625 | 8 | Stopwatch(); |
mdomino | 0:3328857bf625 | 9 | ~Stopwatch(); |
mdomino | 0:3328857bf625 | 10 | void start(); |
mdomino | 0:3328857bf625 | 11 | void stop(); |
mdomino | 0:3328857bf625 | 12 | char* getTime(); |
mdomino | 0:3328857bf625 | 13 | void countDown(int startTime); |
mdomino | 0:3328857bf625 | 14 | private: |
mdomino | 0:3328857bf625 | 15 | int ms; |
mdomino | 0:3328857bf625 | 16 | int sec; |
mdomino | 0:3328857bf625 | 17 | int min; |
mdomino | 0:3328857bf625 | 18 | char buffer[9]; |
mdomino | 0:3328857bf625 | 19 | Timer sw; |
mdomino | 0:3328857bf625 | 20 | }; |