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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Stopwatch.h Source File

Stopwatch.h

00001 #include "stdio.h"
00002 #include "stdlib.h"
00003 #include "math.h"
00004 #include "mbed.h"
00005 
00006 class Stopwatch {
00007 public:
00008     Stopwatch();
00009     ~Stopwatch();
00010     void start();
00011     void stop();
00012     void reset();
00013     char* getTime();
00014     char* getTimeFshort();
00015     void countDown(int startTime);
00016 private:
00017     int ms;
00018     int ms1;
00019     int sec;
00020     int min;
00021    // int sec1;
00022    // int min1;
00023     char buffer1[9];
00024     char buffer2[7];
00025     Timer sw;
00026 };