Hello My name is Evan Gonzalez and I am new to programing, so far I have not run into trouble when programing the controls but I have come across an issue that has halted my teams robot for the game tipping point. I have already programed moving controls and and a conveyor belt control but when we use the program we can not simultaneously use the different controls can you please help me.
void usercontrol(void) {
// User control code here, inside the loop
while (1){
//This Block of code is for Moving Forward.
if(Controller1.ButtonUp.pressing()){
FowardReverseMotor.spin(reverse,100, pct);
LeftDriveMotor.spin(forward, 100, pct);
RightDriveMotor.spin(forward, 100, pct);}
//This Block of code is for Turning Left.
else if(Controller1.ButtonLeft.pressing()){
RightDriveMotor.spin(forward, 100, pct);
LeftDriveMotor.spin(reverse, 100, pct);}
//This Block of code is for Turning Right.
else if(Controller1.ButtonRight.pressing()){
RightDriveMotor.spin(reverse, 100,pct);
LeftDriveMotor.spin(forward, 100, pct);}
//This Block of code is for Moving Backwards
else if(Controller1.ButtonDown.pressing()){
FowardReverseMotor.spin(forward, 100, pct);
LeftDriveMotor.spin(reverse, 100, pct);
RightDriveMotor.spin(reverse, 100, pct);}
//This Block of code is for Moving the Conveyorbelt Up.
else if(Controller1.ButtonA.pressing())
ConveyorbeltMotor.spin(forward, 100, pct);
//This Block of code is for Moving the Conveyorbelt Down.
else if(Controller1.ButtonB.pressing())
ConveyorbeltMotor.spin(reverse, 100, pct);
//This Block of code is to let the Motors to disengage when the are not being used for free Movement.
else {LeftDriveMotor.stop(coast);
RightDriveMotor.stop(coast);
FowardReverseMotor.stop(coast);
ConveyorbeltMotor.stop(coast);}
wait(5, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}
edit: code tags added by mods