PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

Revision:
58:cda5298c9b7f
Parent:
57:79fed71031da
Child:
59:1867088695f3
--- a/source/main.cpp	Sat Mar 31 21:45:08 2018 +0000
+++ b/source/main.cpp	Thu Apr 05 09:53:43 2018 +0000
@@ -20,7 +20,7 @@
 
     while(1) {
         if(state != oldState) {
-            printf("state: %d\r\n",state);
+            printf("\r\nstate: %d\r\n",state);
             oldState = state;
         }
         switch (state) {
@@ -146,8 +146,8 @@
                 printf("\rSD Card test finished\r\n\n");
                 state = 47;
                 break;
-           
-                
+
+
             case 52:
                 user[1] = readMedication(1);
                 if(user[1].valid) {
@@ -175,7 +175,7 @@
                             for(int i=0; i<6; i++) {
                                 printf("%d", user[1].medication.day[day].moment[moment].medContainer.container[i]);
                             }
-                            printf("\r\nThe alarm clock is set for %02d:%02d",user[1].medication.day[day].moment[moment].time.hour,user[1].medication.day[day].moment[moment].time.minute);                          
+                            printf("\r\nThe alarm clock is set for %02d:%02d",user[1].medication.day[day].moment[moment].time.hour,user[1].medication.day[day].moment[moment].time.minute);
                         }
                         printf("\r\n");
                         fflush(stdin);
@@ -184,6 +184,10 @@
                 }
                 state = 47;
                 break;
+            case 54:
+                writeMedication(0,user[1]);
+                state = 47;
+                break;
             default:
                 state = 47; /* Go to State Switch */
                 break;