The Claw working with Buttons (no EMG)

Dependencies:   MODSERIAL Motordriver QEI Servo mbed

Fork of The_Claw by Meike Froklage

Revision:
7:24c9142b2cb3
Parent:
6:23b1ed826b59
--- a/main.cpp	Mon Oct 31 13:59:48 2016 +0000
+++ b/main.cpp	Wed Nov 02 17:18:24 2016 +0000
@@ -59,7 +59,7 @@
 double arm_speed = 0.1;
 
 // position
-float factor_cart = 0.06559;
+float factor_cart = 0.05890;
 float factor_arm = 0.1539;
 int position_cart;
 int position_arm;
@@ -94,16 +94,16 @@
                     Cart.speed(0) == 0;                           
                 
                 }else if (btn && !btn2) {
-                    if(position_cart <= -105){                                  //If the cart is at the right side, it stops
+                    if(position_cart <= -115){                                  //If the cart is at the right side, it stops
                     Cart.stop(1)==1;
                     
                     }else if(position_cart <= -90){                             //If the cart is at 90 mm at the right, it slows down
                     Cart.speed(0.2)==0.2;
                     
-                    }else if(position_cart >= 105 && position_arm <=-45){       //If the cart is at the left side and the arm is rotated 60 degrees to the left, the cart can't move to the right.
+                    }else if(position_cart >= 115 && position_arm <=-45){       //If the cart is at the left side and the arm is rotated 60 degrees to the left, the cart can't move to the right.
                     Cart.stop(1) == 1;
                     
-                    }else if(position_cart >= 105 && position_arm <=-35 && position_claw == -18){
+                    }else if(position_cart >= 115 && position_arm <=-35 && position_claw == -18){
                     Cart.stop(1) == 1;    
     
                     }else{
@@ -111,16 +111,16 @@
                     }
          
                 }else if (!btn && btn2) {
-                    if(position_cart >= 105){                                   //If the cart is at the left side, it stops
+                    if(position_cart >= 115){                                   //If the cart is at the left side, it stops
                     Cart.stop(1)==1;
                     
                     }else if(position_cart >= 90){                             //If the cart is at the right side, it stops
                     Cart.speed(-0.2)==-0.2;
                     
-                    }else if(position_cart <= -105 && position_arm >=45){       //If the cart is at the right side and the arm is rotated 60 degrees to the right, the cart can't move to the left.
+                    }else if(position_cart <= -115 && position_arm >=45){       //If the cart is at the right side and the arm is rotated 60 degrees to the right, the cart can't move to the left.
                     Cart.stop(1)==1;
                       
-                    }else if(position_cart <= -105 && position_arm >=35 && position_claw == 27){
+                    }else if(position_cart <= -115 && position_arm >=35 && position_claw == 27){
                     Cart.stop(1)==1;
                     
                     }else{