Can someone tell me what is wrong with our user control? We want the Intake to go out with tray when button b is pressed. the tray moves, but the intakes do not.
void usercontrol(void) {
// User control code here, inside the loop
while (1) {
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
FL.spin(vex::directionType::fwd, (Controller1.Axis2.value()+Controller1.Axis1.value()), vex::velocityUnits::pct);
BL.spin(vex::directionType::fwd, (Controller1.Axis2.value()+Controller1.Axis1.value()), vex::velocityUnits::pct);
FR.spin(vex::directionType::fwd, (Controller1.Axis2.value()-Controller1.Axis1.value()), vex::velocityUnits::pct);
BR.spin(vex::directionType::fwd, (Controller1.Axis2.value()-Controller1.Axis1.value()), vex::velocityUnits::pct);
/*
FL.spin(vex::directionType::fwd, (Controller1.Axis3.value()), vex::velocityUnits::pct);
BL.spin(vex::directionType::fwd, (Controller1.Axis3.value()), vex::velocityUnits::pct);
FR.spin(vex::directionType::fwd, (Controller1.Axis2.value()), vex::velocityUnits::pct);
BR.spin(vex::directionType::fwd, (Controller1.Axis2.value()), vex::velocityUnits::pct);*/
//The Tray goes out with Button B and in with Button A.
if (Controller1.ButtonA.pressing ()){
Tray.spin(directionType::rev, 100, vex::velocityUnits::pct);
}
else if (Controller1.ButtonB.pressing()){
Tray.spin(directionType::fwd, 100, vex::velocityUnits::pct);
IntakeL.spin(directionType::rev, 30, vex::velocityUnits::pct);
IntakeR.spin(directionType::rev, 30, vex::velocityUnits::pct);
}
else{
Tray.stop(brakeType::hold);
}
if (Controller1.ButtonL1.pressing()){
Lift.spin(directionType::fwd, 100, vex::velocityUnits::pct);
}
else if (Controller1.ButtonL2.pressing()){
Lift.spin(directionType::rev, 100, vex::velocityUnits::pct);
}
else{
Lift.stop(brakeType::hold);
}
if (Controller1.ButtonR1.pressing()){
IntakeL.spin(directionType::fwd, 100, vex::velocityUnits::pct);
IntakeR.spin(directionType::fwd, 100, vex::velocityUnits::pct);
}
else if (Controller1.ButtonR2.pressing()){
IntakeL.spin(directionType::rev, 100, vex::velocityUnits::pct);
IntakeR.spin(directionType::rev, 100, vex::velocityUnits::pct);
}
else if (Controller1.ButtonDown.pressing()){
IntakeL.spin(directionType::rev, 50, vex::velocityUnits::pct);
IntakeR.spin(directionType::rev, 50, vex::velocityUnits::pct);
FL.spin(directionType::rev, 20, velocityUnits::pct);
BL.spin(directionType::rev, 20, velocityUnits::pct);
FR.spin(directionType::rev, 20, velocityUnits::pct);
BR.spin(directionType::rev, 20, velocityUnits::pct);
}
else{
IntakeL.stop(brakeType::hold);
IntakeR.stop(brakeType::hold);
}
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}