PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

Revision:
93:32cd0af29c2b
Parent:
82:2fc026430ff2
Child:
94:b24d2b432b27
--- a/source/main.cpp	Mon Apr 09 15:19:36 2018 +0000
+++ b/source/main.cpp	Tue Apr 10 07:40:58 2018 +0000
@@ -6,7 +6,7 @@
 
 int oldState;
 
-Serial pc(USBTX, USBRX); // tx, rx
+
 
 DigitalIn   lichtschranke(PC_5);
 InterruptIn userButton1(PB_5);
@@ -62,8 +62,11 @@
 }
 
 
+
 int main()
 {
+    setBaud();
+    
     /* SD write Test*/
 
     medicationTime = getTime();
@@ -88,7 +91,7 @@
     */
     /************/
 
-    pc.baud(460800);
+
     printf("start...\r\n");
 
     while(1) {
@@ -186,7 +189,7 @@
                 printf("60\t        \n\r");
                 printf("61\t        \n\r");
                 printf("62\t        \n\r");
-                pc.scanf("%d", &state);
+                scanf("%d", &state);
                 printf("Switch to State %d\n\r",state);
                 fflush(stdin);
                 break;
@@ -198,9 +201,9 @@
                 channel = 0;
                 while (channel < 16) {
                     printf("Channel Number: ");
-                    pc.scanf("%d", &channel);
+                    scanf("%d", &channel);
                     printf("\r\nchannel: %d\n\rDuty Cycle 0..4095: ",channel);
-                    pc.scanf("%d", &dutyCycle);
+                    scanf("%d", &dutyCycle);
                     printf("\n\r%d\n\r",dutyCycle);
                     setPWM((char)channel, (int)dutyCycle);
                     fflush(stdin);
@@ -247,10 +250,10 @@
                     day = 0;
                     while (day < 7) {
                         printf("\r\nDay Number: ");
-                        pc.scanf("%d", &day);
+                        scanf("%d", &day);
                         if(day < 7) {
                             printf("\r\nDay: %d\n\rMoment 0..3: ",day);
-                            pc.scanf("%d", &moment);
+                            scanf("%d", &moment);
                             printf("\r\nMedication for weekday %d Moment %d is ",day,moment);
                             for(int i=0; i<6; i++) {
                                 printf("%d", prescription[1].medication.day[day].moment[moment].medContainer.container[i]);