control for robotic arm that can play chess using a granular gripper
Dependencies: Encoder mbed HIDScope Servo MODSERIAL
Fork of chessRobot by
Diff: buttons.cpp
- Revision:
- 38:2c18429ad352
- Parent:
- 36:6f9670eb9168
- Child:
- 39:41635b1b11de
diff -r 9a9e5a21e47a -r 2c18429ad352 buttons.cpp --- a/buttons.cpp Wed Oct 07 23:21:35 2015 +0200 +++ b/buttons.cpp Wed Oct 07 23:26:59 2015 +0200 @@ -3,7 +3,7 @@ #include "config.h" #include "actuators.h" // functions for reading all the buttons and switches - +int a =3; AnalogIn pot2(pot2Pin); AnalogIn pot1(pot1Pin); @@ -32,17 +32,17 @@ // button 1 to enable/disable actuators // button 2 to switch between states - if(button1 == 0 && prevState1 != 0){ + if(button1.read() == 0 && prevState1 != 0){ motorsEnable = !motorsEnable; } - if(button2 == 0 && prevState2 != 0){ + if(button2.read() == 0 && prevState2 != 0){ actuatorState++; if(actuatorState==3){ actuatorState = 0; } } - prevState1 = button1; - prevState2 = button2; + prevState1 = button1.read(); + prevState2 = button2.read(); pot1Val = pot1.read(); pot2Val = pot2.read();