I have tried to create a program during driver control period that switches the speed to 60% of the speed of the joysticks by clicking the Up Button and 100% of the speed of the joysticks by clicking it again. However, the string “driver” was listed as both unused and undeclared identifiers. Is there anything wrong with the code? Can someone please find similar threads/solutions to refer me to? Thanks in advance!
if (Controller1.ButtonUp.pressing()) {
driveSpeed += 1.0;
}
else {
driveSpeed += 0.0;
if (remainder(driveSpeed, 2) = 0) {
double driver = 0.6;
}
else {
double driver = 1.0;
}
// Set the speed of the left motor. If the value is less than the deadband,
// set it to zero.
if (abs(Controller1.Axis3.position()) > 10) {
// Set the speed to zero.
LeftSide.spin(forward, (Controller1.Axis3.position()*driver), percent);
}
else if (Controller1.ButtonA.pressing()) {
// Set the speed to leftMotorSpeed
LeftSide.spin(forward, 10, percent);
}
else if (Controller1.ButtonY.pressing()) {
// Set the speed to leftMotorSpeed
LeftSide.spin(reverse, 10, percent);
}
else {
LeftSide.stop(brake);
}
// Set the speed of the left motor. If the value is less than the deadband,
// set it to zero.
if (abs(Controller1.Axis2.position()) > 10) {
// Set the speed to zero.
RightSide.spin(forward, (Controller1.Axis2.position()*driver), percent);
}
else if (Controller1.ButtonA.pressing()) {
// Set the speed to leftMotorSpeed
RightSide.spin(forward, 10, percent);
}
else if (Controller1.ButtonY.pressing()) {
// Set the speed to leftMotorSpeed
RightSide.spin(reverse, 10, percent);
}
else {
RightSide.stop(brake);
}