main reminder functionality

Dependencies:   mbed 4DGL-uLCD-SE SDFileSystem

Revision:
6:ce8d4456e28b
Parent:
5:69da174d0f56
Child:
7:d85521f4f0c3
--- a/main.cpp	Tue Dec 06 19:12:47 2016 +0000
+++ b/main.cpp	Tue Dec 06 23:32:59 2016 +0000
@@ -51,7 +51,7 @@
     pb2.mode(PullUp);
     wait(.01);
     pb2.fall(&pb2_hit_interrupt);
-
+    
     srand (time(NULL)); // initialize random numbers
     /*
     int i = 0;
@@ -74,6 +74,13 @@
     // test_reminder.tm_time.tm_mon = 0; // months since January
     // test_reminder.tm_time.tm_year = 0; // years since 1970
     //myschedule.addReminder(test_reminder);
+    // wake up EasyVR
+    easyVR.putc('b');
+    while (easyVR.getc()!='o') {
+        easyVR.putc('b');
+        wait(0.1);
+    }
+    
     uLCD.printf("waiting to receive schedule\n");
     receive_schedule();
     int current_time = schedule_read();
@@ -125,10 +132,13 @@
                 uLCD.printf("checking app\n");
                 //if (timeinfo->tm_min == tmpReminder.min && timeinfo->tm_hour == tmpReminder.hour - 1) {
                 //if (tmpReminder.hour - timeinfo->tm_hour <= 1) {
-                if (time_diff <= 60) {
-
+                if (time_diff == 60) {
+                    
                     myled = true;
                     synthesis(tmpReminder);
+                    if (myschedule.getSize() == 1) {
+                        while (1) {}
+                    }
                     uLCD.printf("moving to next reminder\n");
                     myschedule.nextReminder();
                     uLCD.printf("moved to next reminder\n");
@@ -139,15 +149,19 @@
                     myled = true;
                     synthesis(tmpReminder);
                     uLCD.printf("moving to next reminder\n");
+                    if (myschedule.getSize() == 1) {
+                        while (1) {}
+                    }
                     myschedule.nextReminder();
                     uLCD.printf("moved to next reminder\n");
                     flag = 0;
                 }
             }
-            wait(1);
+            //if (myschedule.getSize() == 
+            //    wait(1);
         }
         uLCD.printf("All reminders done for the day\n");
-        while(1) {}
+        //while(1) {}
     }
 }