EMG and motor script together, Not fully working yet,.

Dependencies:   Encoder MODSERIAL QEI biquadFilter mbed

Fork of Code_MotorEMG by Joost Herijgers

Revision:
17:0acc8d4b142c
Parent:
16:d75bf6d7d60e
Child:
18:00379f0ecc7f
diff -r d75bf6d7d60e -r 0acc8d4b142c main.cpp
--- a/main.cpp	Wed Nov 01 12:26:20 2017 +0000
+++ b/main.cpp	Wed Nov 01 12:34:47 2017 +0000
@@ -361,7 +361,7 @@
     
     int error_o = reference_o - position_o;
     
-    pc.printf("Position_o = %i          reference_o=%i              Error_o=%i\n\r" ,position_o,reference_o,error_o);
+    //pc.printf("Position_o = %i          reference_o=%i              Error_o=%i\n\r" ,position_o,reference_o,error_o);
     
     if (-100<error_o && error_o<100){
         motorValue1 = 0;
@@ -396,7 +396,7 @@
         motorValue2 = 0;
         }
     else {
-    motorValue2 = 0.1*P2(error_b, kpb);
+    motorValue2 = 0.05*P2(error_b, kpb);
     }    
         
     
@@ -427,7 +427,7 @@
         
         }
     else {
-    motorValue3 = 0.1*P3(error_r, kpr);
+    motorValue3 = 0.05*P3(error_r, kpr);
     }    
             
     if (motorValue3 >=0) motor3DirectionPin=1;
@@ -494,7 +494,7 @@
 float Ps(){
     Psx=(Xin_new)*30+91;
     Psy=(Yin_new)*30+278;     
-    pc.printf("x=%.2f \n\r y=%.2f \n\r",Psx,Psy);
+ //   pc.printf("x=%.2f \n\r y=%.2f \n\r",Psx,Psy);
     return 0;
 }
  
@@ -508,7 +508,7 @@
         Vey=(Vey/modVe)*Vmax;
     }*/
     Pst();
-    pc.printf("Vex=%.2f \r\n Vey=%.2f \r\n",Vex,Vey);
+ //   pc.printf("Vex=%.2f \r\n Vey=%.2f \r\n",Vex,Vey);
     if((fabs(Vex)<0.01f)&&(fabs(Vey)<0.01f)){
         Move_done=true;
         loop.detach();