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

Stopwatch.h

Committer:
fox46
Date:
2013-05-08
Revision:
2:2202f5336acb
Parent:
0:3328857bf625

File content as of revision 2:2202f5336acb:

#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "mbed.h"

class Stopwatch {
public:
    Stopwatch();
    ~Stopwatch();
    void start();
    void stop();
    void reset();
    char* getTime();
    char* getTimeFshort();
    void countDown(int startTime);
private:
    int ms;
    int ms1;
    int sec;
    int min;
   // int sec1;
   // int min1;
    char buffer1[9];
    char buffer2[7];
    Timer sw;
};