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:
- 60:20945383ad1b
- Parent:
- 59:fe00be2cf8fd
- Child:
- 62:6c566e6f9664
diff -r fe00be2cf8fd -r 20945383ad1b buttons.cpp --- a/buttons.cpp Mon Oct 12 12:16:58 2015 +0200 +++ b/buttons.cpp Mon Oct 12 11:46:05 2015 +0000 @@ -49,7 +49,7 @@ #ifdef TUNEPID setForPID(); // if TUNEPID is defined, use potmeters for PID tuning - #elif + #else setForPositions(); // else use it for motor control #endif } @@ -72,15 +72,15 @@ switch (PIDparam){ case 0: // potmeters control P gain redLed.write(0); greenLed.write(1); blueLed.write(1); - float Kp =3* pot2.read()+1; + Kp =3* pot1.read()+1; break; case 1: // potmeters control I gain redLed.write(1); greenLed.write(0); blueLed.write(1); - float Ki = pot2.read(); + Ki = pot1.read(); break; case 2: // potmeters control D gain redLed.write(1); greenLed.write(1); blueLed.write(0); - float Kd = pot2.read(); + Kd = pot1.read(); break; } motor2PID.SetTunings(Kp, Ki, Kd);