Thomas Burgers / Mbed 2 deprecated ZZ-TheChenneRobot

Dependencies:   Encoder HIDScope MODSERIAL QEI biquadFilter mbed

Revision:
32:10e6160fdbaa
Parent:
31:113f630f7e7d
Child:
33:5386ccaa5160
--- a/main.cpp	Mon Oct 12 21:13:56 2015 +0000
+++ b/main.cpp	Mon Oct 12 21:37:11 2015 +0000
@@ -47,7 +47,7 @@
     PwmOut pwm_motor_strike(D5);              // Pwm for motor Turn
     DigitalOut motordirection_strike(D4);     // Direction of the motor Turn
     
-    double reference_turn=0;                  // Set constant to store reference value of the Turn motor
+    double reference_turn;                  // Set constant to store reference value of the Turn motor
     double position_turn;                     // Set constant to store current position of the Turn motor
     double position_strike;
     float EMG_R;
@@ -65,6 +65,8 @@
     //  START OF CODE    //
     pc.printf(" Start of code \n\r");
     
+    reference_turn=0;
+    
     pc.baud(115200);                                    // Set the baudrate
     
     //  Calibratie   //
@@ -100,8 +102,8 @@
         debug_led_blue=off;
         debug_led_green=on;                                                            // LED Turns green if ready for a new action
         wait(1);
-        EMG_R = (potmeter1.read());                                                //EMG Right bicep (tussen nul en 100%)
-        EMG_L = (potmeter2.read());                                                // EMG Left bicep  (tussen nul en 100%)
+        EMG_R = (potmeter1.read())*100;                                                //EMG Right bicep (tussen nul en 100%)
+        EMG_L = (potmeter2.read())*100;                                                // EMG Left bicep  (tussen nul en 100%)
         pc.printf("EMG_L = %f EMG_R = %f \n\r", EMG_L, EMG_R);
         
         
@@ -191,7 +193,9 @@
                             debug_led_blue=off;
                             reference_turn=reference_turn-change_one_bottle;
                             n=1;
-                        }                                                             //(45 graden naar rechts voor volgende fles) //wordt maar 1 keer uitgevoerd
+                        }
+                                                                                     //(45 graden naar rechts voor volgende fles) //wordt maar 1 keer uitgevoerd
+                        pc.printf("Ref: %f Err: %f \n\r", reference_turn, position_turn);
                         
                         if (abs(position_turn-reference_turn)<2)                      // als error en kleiner dan twee graden
                             {