control for robotic arm that can play chess using a granular gripper
Dependencies: Encoder mbed HIDScope Servo MODSERIAL
Fork of chessRobot by
Diff: actuators.cpp
- Revision:
- 34:f315b2b38555
- Parent:
- 32:2006977785f5
- Child:
- 44:a947bc232d84
diff -r 0baaf98c717d -r f315b2b38555 actuators.cpp --- a/actuators.cpp Wed Oct 07 18:56:52 2015 +0000 +++ b/actuators.cpp Wed Oct 07 19:04:09 2015 +0000 @@ -4,9 +4,9 @@ #include "config.h" #include "encoder.h" #include "HIDScope.h" -#include "servo.h" +#include "Servo.h" // functions for controlling the motors - bool motorEnable = true; + bool motorsEnable = false; bool direction1 = false; // CCW is false(positive rotation), CW is true (neg rotation) bool direction2 = false; @@ -58,7 +58,7 @@ PID PIDmotor1(Kp1, Ki1, Kd1, PIDinterval); PID PIDmotor2(Kp2, Ki2, Kd2, PIDinterval); - servo Servo(servoPin); + Servo servo(servoPin); Timer t; void motorInit(){ @@ -92,7 +92,7 @@ void motorControl(){ - if(motorEnable){ // only run motors if switch is enabled + if(motorsEnable){ // only run motors if switch is enabled // get encoder positions in degrees // 131.25:1 gear ratio // getPosition uses X2 configuration, so 32 counts per revolution @@ -150,7 +150,7 @@ void servoControl(){ // use potMeter Value to set servo angle - Servo.write(servoPos); + servo.write(servoPos); // (optionaly calculate xy position to keep balloon in position) // calculate z position using angle // calculate x y translation of endpoint