Simple stopwatch with LCD

Dependencies:   TextLCD mbed

main.cpp

Committer:
christian
Date:
2011-01-23
Revision:
0:dad37b1aabc1

File content as of revision 0:dad37b1aabc1:

#include "mbed.h"
#include "TextLCD.h"

TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3
Serial pc(USBTX, USBRX); // tx, rx
Timer t;

int k=0;
int c;
int main()
 {

    while(1)
    {
     char c = pc.getc();
        if((c == 'u') && k==0)
        {
            lcd.cls();
            t.start();
            lcd. printf("Hello\n");
            k=1;
        }
        if((c == 'd') &&  k==1) 
        {
            t.stop();
            lcd.printf(" %f sec\n", t.read());
            k=0;
            t.reset();
         }
     } 
       
}