What is wrong with our current drive code? We are trying to have our robot tank control and be able to move our robot arm up and down as well as open and close our claw. So far, we have been able to fix the drive issue but as soon as we did, the claw and lift arm stopped working, any ideas on how to fix our code? Do we need to make two loops?
void usercontrol( void ) {
// User control code here, inside the loop
while(true) {
FrontLeftDrive.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct); //(Axis3+Axis4)/2
BackLeftDrive.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct); //(Axis3+Axis4)/2
FrontRightDrive.spin(vex::directionType::rev, Controller1.Axis2.value(), vex::velocityUnits::pct);//(Axis3-Axis4)/2
BackRightDrive.spin(vex::directionType::rev, Controller1.Axis2.value(), vex::velocityUnits::pct);//(Axis3-Axis4)/2
}
//Use these variables to set the speed of the arm and claw.
int armSpeedPCT = 50;
int clawSpeedPCT = 50;
if(Controller1.ButtonUp.pressing()) {
LeftLift.spin(directionType::fwd, armSpeedPCT, velocityUnits::pct);
RightLift.spin(directionType::rev, armSpeedPCT, velocityUnits::pct);
}
else if(Controller1.ButtonDown.pressing()) {
LeftLift.spin(directionType::rev, armSpeedPCT, velocityUnits::pct);
RightLift.spin(directionType::fwd, armSpeedPCT, velocityUnits::pct);
}
else {
LeftLift.stop(brakeType::brake);
RightLift.stop(brakeType::brake);
}
if(Controller1.ButtonA.pressing()) {
LeftClaw.spin(directionType::fwd, clawSpeedPCT, velocityUnits::pct);
RightClaw.spin(directionType::rev, clawSpeedPCT, velocityUnits::pct);
}
else if(Controller1.ButtonY.pressing()) {
LeftClaw.spin(directionType::rev, clawSpeedPCT, velocityUnits::pct);
RightClaw.spin(directionType::fwd, clawSpeedPCT, velocityUnits::pct);
}
else {
LeftClaw.stop(brakeType::brake);
RightClaw.stop(brakeType::brake);
}
task::sleep(20);
}