Final project code

Dependencies:   4DGL-uLCD-SE MAX31855 mbed-rtos mbed

Fork of Coffee_Roaster_Threads by Eric Patterson

Stopwatch.cpp

Committer:
ericspatterson
Date:
2014-12-02
Revision:
9:d7300899fd85
Parent:
8:1db15ab871a4

File content as of revision 9:d7300899fd85:

#include "Stopwatch.h"
#include "mbed.h"
 
Stopwatch::Stopwatch() {
    // constructor
}
 
Stopwatch::~Stopwatch() {
    // destructor
}
 
void Stopwatch::start() {
    // Start the timer
    sw.start();
}
 
void Stopwatch::stop() {
    // Stop the timer
    sw.stop();
}
 
char* Stopwatch::getTime() {
    // Convert time in milliseconds to 00:00:00 format for output to LCD
    // Returns a pointer to a 8 char array in time format
    ms = sw.read_ms();
    sec = (ms/1000);
    ms = ms - (sec*1000);
    min = (sec/60);
    sec = sec - (min*60);
    ms = (ms/10);
    sprintf(buffer, "%02d:%02d:%d", min, sec, ms);
    return buffer;
}