Quote:
Originally Posted by RoboElite640
well, i didnt get a chance to try that, but essentially I'm trying to have it set up so that when i press one button the robot will drive faster. And if i press another button the robot will drive slower.
|
Ah, okay. What you're doing in the code above is basically autonomous. It'll just drive instead of powering the motors to a set limit.
I'd recommend having your program use Jaguar objects in your Drive train instead of integers (assuming you are using int's)
Once you do this you should be able to limit it in teleop.
Code:
RobotDrive drive = new RobotDrive(leftMotor, rightMotor);
if(leftMotor.get() >= 0.5) {
leftMotor.set(0.5);
} else if(rightMotor.get() >= 0.5) {
rightMotor.set(0.5);
}
// then call your drive methods and it'll limit the max speed to 0.5