timer

Dependencies:   mbed TextLCD

main.cpp

Committer:
josedaparte
Date:
2015-11-30
Revision:
4:ceb67991be6b
Parent:
3:a3c969ad9f9a

File content as of revision 4:ceb67991be6b:

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

Timer t;
TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2);

int hora=0, min=0, seg=0;

int main()
{
    lcd.cls();
    t.start();
    do
    {   
        
        seg = t.read();
        if(seg == 60)
        {
            seg=0;
            t.reset();
            min++;
           
        }
        if(min==60)
        {
            min=0;
            hora++;
            
        }
        if(hora==24)
        {
            hora=0;
        }
                   
        lcd.locate(0,0);
        lcd.printf("%i:%i:%i", hora, min, seg);
        
    } while(1);
       
}