Script for controlling 2 DC-motors and a gripper-servo using buttons
Dependencies: MODSERIAL QEI Servo mbed
Diff: main.cpp
- Revision:
- 7:9a3809a9ab3e
- Parent:
- 6:98121d2d76a6
- Child:
- 8:9c58ca13076e
diff -r 98121d2d76a6 -r 9a3809a9ab3e main.cpp --- a/main.cpp Mon Oct 10 11:03:35 2016 +0000 +++ b/main.cpp Mon Oct 10 11:09:35 2016 +0000 @@ -12,12 +12,12 @@ PwmOut Speed_M2(D6); //To control the translation direction of the arm DigitalOut Direction_M2(D7); //To control the translation speed of the arm -Servo gripper_servo(D3); //To control the gripper (Note: D8=PTC12) +Servo gripper_servo(D13); //To control the gripper (Note: D8=PTC12) -InterruptIn Switch_1(D9); //To control the rotation to the left -InterruptIn Switch_2(D10); //To control the rotation to the right -InterruptIn Switch_3(D11); //To control the translation of the arm -InterruptIn Switch_4(D12); //To control the gripper +InterruptIn Switch_1(SW2); //To control the rotation to the left +InterruptIn Switch_2(SW3); //To control the rotation to the right +InterruptIn Switch_3(D2); //To control the translation of the arm +InterruptIn Switch_4(D3); //To control the gripper int counter_rotation_left=0; //To count the number of times the rotation_left switch (switch_1) has been pushed int counter_rotation_right=0; //To count the number of times the rotation_right switch (switch_2) has been pushed