![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Ds1307
Dependencies: RTC-DS1307 TextLCD mbed
Diff: main.cpp
- Revision:
- 0:0616025d9f54
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jun 08 00:43:27 2015 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "Rtc_Ds1307.h" +#include "TextLCD.h" + + +Rtc_Ds1307 rtc(PTE0, PTE1); +TextLCD lcd(PTE5, PTE4, PTE3, PTE2, PTB11, PTB10); // rs, e, d4-d7 +Serial pc(USBTX, USBRX, "pc"); + +int main(){ + Rtc_Ds1307::Time_rtc tm = {}; + rtc.startClock(); + + while(1) { + + rtc.getTime(tm); + lcd.locate(0,0); + lcd.printf("Hora:%02d:%02d:%02d\n\r",tm.hour, tm.min, tm.sec); + lcd.locate(0,1); + lcd.printf("Fech:%02d/%02d/%04d\n\r", tm.date, tm.mon, tm.year); + + } + } \ No newline at end of file