![](/media/cache/profiles/bd1ce36d68a5c2bea97fe45863673b20.jpg.50x50_q85.jpg)
reloj con ds1307 y LCD de 20x4
Dependencies: RTC-DS1307 TextLCD mbed
Fork of Rtc_Ds1307_Sample by
main.cpp
- Committer:
- leihen
- Date:
- 2013-06-02
- Revision:
- 0:431183c5b136
- Child:
- 1:6dbe51fe0737
File content as of revision 0:431183c5b136:
#include "mbed.h" #include "Rtc_Ds1307.h" DigitalOut myled(LED1); Rtc_Ds1307 rtc(p28, p27); Serial pc(USBTX, USBRX, "pc"); char buffer[128]; int readptr = 0; int main() { char c; pc.printf("Good morning Henry\n"); Time tm = {}; while(1) { pc.printf("*************************************\n"); pc.printf("* Menu for RTC Test : *\n"); pc.printf("* read - reads the clock *\n"); pc.printf("* start - start the clock *\n"); pc.printf("* stop - stop the clock *\n"); pc.printf(" write - write the clock *\n"); pc.printf("*************************************\n"); while( (c = pc.getc()) != '\n') { buffer[readptr++] = c; } buffer[readptr++] = 0; if (strncmp(buffer, "read", 4) == 0) { // perform read pc.printf("Performing read operation\n"); if (rtc.getTime(tm) ) { pc.printf("The current time is : %02d:%02d:%02d\n", tm.hour, tm.min, tm.sec); } } else if (strncmp(buffer, "write", 5) == 0) { // perform write pc.printf("Performing write operation\n"); } else if (strncmp(buffer, "start", 5) == 0) { // start pc.printf("Performing start operation\n"); } else if (strncmp(buffer, "stop", 4) == 0) { // stop pc.printf("Performing stop operation\n"); } else { pc.printf("syntax error\n"); } readptr = 0; pc.printf("\n\n\n"); } }