I have a competition tomorrow and I don’t have a working autonomous. I do not want to stay up all night, so i decided to finish a simpler autonomous that my team started earlier. The only way to start that is to press some buttons on the brain but when i press a button, it automatically starts the autonstart();
function before i am even finished. Can anyone identify the problem?
Code:
void Autonomous(int color, int tile){
if (color%2 == 0){
if (tile%2 == 0) {
autonstart();
LeftBarMotor.stop(brakeType::hold);
RightBarMotor.stop(brakeType::hold);
LeftIntakeMotor.spin(directionType::rev, 100, velocityUnits::pct);
RightIntakeMotor.spin(directionType::fwd, 100, velocityUnits::pct);
LeftDrive.rotateTo(convert(38), rotationUnits::rev, 50, velocityUnits::pct, false);
RightDrive.rotateTo(convert(38), rotationUnits::rev, 50, velocityUnits::pct,true);
wait(211, msec);
RightDrive.spin(directionType::fwd,100, percentUnits::pct);
LeftDrive.spin(directionType::rev, 100, percentUnits::pct);
wait(1.475, sec);
LeftDrive.resetRotation();
RightDrive.resetRotation();
LeftDrive.rotateTo(convert(23), rotationUnits::rev, 50, velocityUnits::pct, false);
RightDrive.rotateTo(convert(23), rotationUnits::rev, 50, velocityUnits::pct,true);
LeftIntakeMotor.stop(brakeType::coast);
RightIntakeMotor.stop(brakeType::coast);
Deposit();
LeftIntakeMotor.spin(directionType::fwd, 100, velocityUnits::pct);
RightIntakeMotor.spin(directionType::rev, 100, velocityUnits::pct);
LeftDrive.rotateTo(convert(-5), rotationUnits::rev, 100, velocityUnits::pct, false);
RightDrive.rotateTo(convert(-5), rotationUnits::rev, 100, velocityUnits::pct,true);
}