DECS @UNIST / Mbed 2 deprecated Anybaro_ver_7

Dependencies:   mbed

Revision:
17:9a060d2daca8
Parent:
15:e5e34512a00e
Child:
18:25281ee3a517
--- a/ForceRead.cpp	Thu Jul 04 07:02:58 2019 +0000
+++ b/ForceRead.cpp	Thu Jul 04 07:59:14 2019 +0000
@@ -103,39 +103,47 @@
 
 void ReadForce()
 {
-    float force_L[4];
-    float force_R[4];
+//    float force_L[4];         // not used    
+//    force_L[0] = force_L1.read();         // not used
+//    force_L[1] = force_L2.read();         // not used
+//    force_L[2] = force_L3.read();         // not used
+//    force_L[3] = force_L4.read();         // not used
+
     
-    force_L[0] = force_L1.read();
-    force_L[1] = force_L2.read();
-    force_L[2] = force_L3.read();
-    force_L[3] = force_L4.read();
+
+//    bt.printf("%1.3f,%1.3f,%1.3f,%1.3f\n",force_R[0],force_R[1],force_R[2],force_R[3]);           //debug purpose
+// ======================================== BH 190704 reomoved
+//    float force_R[4];
+//    force_R[0] = force_R1.read();
+//    force_R[1] = force_R2.read();
+//    force_R[2] = force_R3.read();
+//    force_R[3] = force_R4.read();
+
+//    bt.putc('<');
+//    bt.putc('F');
+//    bt.putc('O');
+//    bt.putc('T');
+//
+//    bt.putc((char)((unsigned int)(force_R[0]*127)));
+//    bt.putc((char)((unsigned int)(force_R[1]*127)));
+//    bt.putc((char)((unsigned int)(force_R[2]*127)));
+//    bt.putc((char)((unsigned int)(force_R[3]*127)));
+//    bt.putc('>');
+//    bt.putc('\r');
+//    bt.putc('\n');
+// ======================================== BH 190704 added
+    int force_R[4];
     force_R[0] = force_R1.read();
     force_R[1] = force_R2.read();
     force_R[2] = force_R3.read();
-    force_R[3] = force_R4.read();
-    
-    bt.putc('2');
-////    bt.printf("%1.3f,%1.3f,%1.3f,%1.3f\n",force_R[0],force_R[1],force_R[2],force_R[3]);
-    bt.putc('<');
-    bt.putc('F');
-    bt.putc('O');
-    bt.putc('T');
-////    bt.putc((char)((unsigned int)(force_L[0]*127)));
-////    bt.putc((char)((unsigned int)(force_L[1]*127)));
-////    bt.putc((char)((unsigned int)(force_L[2]*127)));
-////    bt.putc((char)((unsigned int)(force_L[3]*127)));
-    bt.putc((char)((unsigned int)(force_R[0]*127)));
-    bt.putc((char)((unsigned int)(force_R[1]*127)));
-//    bt.putc((char)((unsigned int)(force_R[2]*127)));
-//    bt.putc((char)((unsigned int)(force_R[3]*127)));
-    bt.putc('>');
-    bt.putc('\r');
-    bt.putc('\n');
-
-    
-    
-    
-
+    force_R[3] = force_R4.read();           // 0 ~ 1
+    for(int i=0; i<4 ; i++){
+        force_R[i]*=100;                    //forcr_R range = 0~1    -> changed 0~99
+        if(force_R[i] > 100) force_R[i] = 99;   // for fixed space 2
+    }
+    bt.printf("<FOT%d%d%d%d>\n", force_R[0],
+                                force_R[1],
+                                force_R[2],
+                                force_R[3]);
     
 }       
\ No newline at end of file