PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

Revision:
90:d0805b58b0ae
Parent:
85:04fe3dff23f4
Child:
91:443b0ac21de0
--- a/source/main.cpp	Mon Apr 09 15:05:43 2018 +0000
+++ b/source/main.cpp	Mon Apr 09 15:43:45 2018 +0000
@@ -101,8 +101,21 @@
                 printf("Hello World");
                 state = 47;
                 break;
+                
             case 1:
+                char command;
+                if(pc.readable()) {
+                    command = pc.getc();
+                } else if(command == 'w') {
+                    if(pc.writeable()) {
+                        printf("%s", send);
+                    }
+                } else {
+                    state = 47;
+                }
+
                 break;
+
             case 2:
                 break;
             case 3:
@@ -142,7 +155,7 @@
 
                 /**************************************************************/
                 /* Test Zone */
-                
+
                 /* Speedtest Servo */
             case 41:
                 setSpeed(1, 2);
@@ -153,27 +166,27 @@
                 wait(3);
                 state = 43;
                 break;
-                
+
                 /* DutyCycle */
             case 42:
                 printf("case 42:\r\n");
                 initInterrupt();
                 printf("initInterrupt\r\n");
                 enableContainer(1);
-                while(1){
+                while(1) {
                     printf("%i\r\n", getDutyCycle());
                     printf("--- END ---\r\n");
                     wait(0.2);
                 }
                 break;
-                
+
                 /* Drehung 90° */
             case 43:
                 printf("case 43:\r\n");
                 initInterrupt();
                 printf("initInterrupt\r\n");
                 enableContainer(1);
-                while(1){
+                while(1) {
                     nextPosition(1);
                     printf("--- END ---\r\n");
                     wait(3);
@@ -438,6 +451,14 @@
 
                 break;
 
+            case 68:
+                printf("read_Inventory\n\r");
+                send = read_Inventory();
+                printf("%s", send);
+                state = 47;
+
+                break;
+
             default:
                 state = 47; /* Go to State Switch */
                 break;