In this :
Code:
public void teleopPeriodic() {
if (control.getRawButton(1)){ // if button 1 pressed drive at full speed
driveSys.tankDrive(control, 2, control, 5);
}else { // else drive at half speed
driveSys.tankDrive(control, 2, control, 5);
driveSys.setMaxOutput(0.5);
}
}
Make sure you setMaxOutput() back to 1 when the button is pressed. So,
Code:
public void teleopPeriodic() {
if (control.getRawButton(1)){ // if button 1 pressed drive at full speed
driveSys.tankDrive(control, 2, control, 5);
driveSys.setMaxOutput(1);
}else { // else drive at half speed
driveSys.tankDrive(control, 2, control, 5);
driveSys.setMaxOutput(0.5);
}
}