reloj
Dependencies: Debounced TextLCD mbed
Diff: main.cpp
- Revision:
- 0:1cb6019bbd61
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 06 17:17:37 2016 +0000 @@ -0,0 +1,55 @@ +#include "mbed.h" +//#include "DebouncedIn.h" +#include "TextLCD.h" + +Serial pc(USBTX,USBRX); +TextLCD lcd(PTB9, PTB10, PTE2, PTE3, PTE4, PTE5); +DigitalOut myled(LED1); +DigitalIn pulsador1 (D3); +DigitalIn pulsador2 (D4); +int horas; +int minutos; +int segundos; +DigitalOut alarma (D6); +Timer t; + +int main() +{ + lcd.cls(); + t.start(); + do + { + + segundos = t.read(); + if(segundos == 60){ + segundos=0; + t.reset(); + minutos++; + + } + if(minutos==60){ + minutos=0; + horas++; + + } + if(horas==24){ + horas=0; + } + + lcd.locate(0,1); + lcd.printf("0%d:0%d:%d", horas, minutos, segundos); + lcd.locate(2,0); + lcd.printf("La hora es:"); + + } + while(1);{ + + if (pulsador1==0){ + horas++; + } + if (pulsador2==0){ + minutos++; + } +} + +} \ No newline at end of file