backup
Dependencies: MODSERIAL Motordriver QEI Servo mbed HIDScope
Fork of The_Claw_Back-up_Buttons by
Diff: main.cpp
- Revision:
- 11:97f824629da5
- Parent:
- 10:31e4c3d71ee6
- Child:
- 12:b31df384b170
diff -r 31e4c3d71ee6 -r 97f824629da5 main.cpp --- a/main.cpp Wed Nov 02 15:54:32 2016 +0000 +++ b/main.cpp Wed Nov 02 16:13:32 2016 +0000 @@ -307,16 +307,13 @@ num_turned_on_0++; if (rlf_y > threshold_value) { - if(position_cart <= -105){ //If the cart is at the right side, it stops + if(position_cart <= -10){ //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 >= 10 && 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 >= 10 && position_arm <=-35 && position_claw == -18){ Cart.stop(1) == 1; }else{ @@ -324,16 +321,10 @@ } }else if (llf_y > threshold_value) { - if(position_cart >= 105){ //If the cart is at the left side, it stops + if(position_cart >= 10){ //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. - Cart.stop(1)==1; - - }else if(position_cart <= -105 && position_arm >=35 && position_claw == 27){ + }else if(position_cart <= -10 && position_arm >=35 && position_claw == 27){ Cart.stop(1)==1; }else{ @@ -341,14 +332,7 @@ } }else { - Arm.speed(0) == 0; - if(position_cart<0){ - Cart.speed(-0.1)== -0.1; - }else if(position_cart>0){ - Cart.speed(0.1)==0.1; - }else{ - Cart.stop(0)==0; - } + } } @@ -465,7 +449,7 @@ tick_part.attach(&SwitchCart,kTimeToggle); tick_part_arm.attach(&SwitchArm,kTimeToggle); sampleTicker.attach(scopeSend,0.01); - measureTicker.attach(Measure, 0.01); + measureTicker.attach(Measure, 0.005); btn_cart.fall(&SetValue2); btn_arm.fall(&SetValue3);