DECS @UNIST / Mbed 2 deprecated Anybaro_ver_7

Dependencies:   mbed

Revision:
7:8fb5513a2231
Parent:
5:6bb52b2a79bf
Parent:
6:549177f76f8e
Child:
8:a435e7aa7a02
--- a/main.cpp	Wed Dec 26 10:58:58 2018 +0000
+++ b/main.cpp	Wed Dec 26 11:04:24 2018 +0000
@@ -99,7 +99,10 @@
         case 2 :
         bt.puts("ANYBARO");
         
-        break;      
+        break;
+        
+        default:
+            break;
     }
     
 }
@@ -113,7 +116,13 @@
 {
     float d1 = disSensor.read();
     float d2 = parA*d1*d1+parB*d1+parC;
-    bt.printf("%1.2f",d2);
+
+//    original
+//    bt.printf("%1.2f",d2);
+
+//    fixed
+    bt.printf("<DIO%1.4f>",d2);
+    
 }
 
 void ModeSelect(int mode)       // [ADD] MODE
@@ -152,7 +161,7 @@
         case 3 :                            //Read Angle
         
         timer2.detach();        
-        ReadAng();
+        ReadAng();                          // return only one message
 
         break;
      
@@ -177,7 +186,7 @@
     
     if( 1 == sysStatus | 2 == sysStatus)
     {
-        bt.puts("Please Wait Moving Anybaro");
+        bt.puts("Please Wait Moving Anybaro");              //<STA>
     }
     else
     {
@@ -192,7 +201,8 @@
 {
     if( 1 == sysStatus | 2 == sysStatus)
     {
-        bt.puts("Please Wait Moving Anybaro");
+        bt.puts("Please Wait Moving Anybaro");              //<STA> 또는 ifdef debug 처리?
+        
     }
     else
     {
@@ -204,11 +214,11 @@
 {
     bt.baud(115200);
     pc.baud(115200);
-    bt.puts("START 181203 Ver.6 \n");
+    bt.puts("START 181203 Ver.6 \n");                       // ifdef debug
 
-    int modeNum = 0;    
+    int modeNum = 0;   
     int modeLED = 0;
-    int modeMotor =0;
+    int modeMotor = 0;
 
     char tmpCommand[4]={0,};                     // [ADD] command
     int rxVal;
@@ -245,7 +255,7 @@
                 #ifdef DEBUG
                 bt.puts("\nLED CONTROL MODE!!\n");
                 #endif
-                modeLED = rxVal;
+                modeLED = rxVal;                    //  if(modeLED != 0 || modeLED != 1 || modeLED != 2) 
                 ControlLED(modeLED);
             }
 
@@ -254,8 +264,9 @@
                 #ifdef DEBUG
                 bt.puts("\nMODE SELECT!!\n");
                 #endif
-                modeNum = rxVal;
-                sysStatus = rxVal;
+                modeNum = rxVal;                    // 1 ~ 6
+                sysStatus = rxVal;                  // Why this value are assigned directly?
+                                                    // assigning sys variable after checking condition is correct progress, i think.
                 ModeSelect(modeNum);
             }
             
@@ -265,14 +276,14 @@
                 bt.puts("\nMOTOR TEST CONTROL MODE!!\n");
                 #endif
                 modeMotor = rxVal;
-                MotorTest(modeMotor);                      
+                MotorTest(modeMotor);
             }
             
             else if (0 == strcmp(tmpCommand,"POS"))
             {
                 #ifdef DEBUG
                 bt.puts("\nMOTOR DISTANCE CONTROL MODE!!\n");
-                #endif        
+                #endif
                 targetDis = rxVal;
                 timer1.attach(&ControlAng,0.8);
             }