Tarea sobre el reloj con alarma.

Dependencies:   Debounced RTC-DS1307 TextLCD mbed

Fork of Rtc_Ds1307_lcd_alarma by Walter y Gregorio

Revision:
0:431183c5b136
Child:
1:6dbe51fe0737
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jun 02 18:57:52 2013 +0000
@@ -0,0 +1,56 @@
+#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");
+    }
+}