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 Matt Dominey

Committer:
fox46
Date:
Wed May 08 09:16:46 2013 +0000
Revision:
2:2202f5336acb
Parent:
0:3328857bf625
added gettimeFshort, shorter formated "0:00:0"

Who changed what in which revision?

UserRevisionLine numberNew 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();
fox46 2:2202f5336acb 12 void reset();
mdomino 0:3328857bf625 13 char* getTime();
fox46 2:2202f5336acb 14 char* getTimeFshort();
mdomino 0:3328857bf625 15 void countDown(int startTime);
mdomino 0:3328857bf625 16 private:
mdomino 0:3328857bf625 17 int ms;
fox46 2:2202f5336acb 18 int ms1;
mdomino 0:3328857bf625 19 int sec;
mdomino 0:3328857bf625 20 int min;
fox46 2:2202f5336acb 21 // int sec1;
fox46 2:2202f5336acb 22 // int min1;
fox46 2:2202f5336acb 23 char buffer1[9];
fox46 2:2202f5336acb 24 char buffer2[7];
mdomino 0:3328857bf625 25 Timer sw;
mdomino 0:3328857bf625 26 };