My autonomous button feature not working and have a competition tomorrow!

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);

}

I’m absolutely horrible at programming and just copy and paste last years auton and modify it but i think you need a competition template

Many first years team happen to not even have an auton, just look at some tournament videos, it’s finess it’s still early season so it’s very likely that the teams will not be so high level

1 Like

You could just place your bot facing the goal zone with a cube in front of the goal zone. Drive forward 6 inches and then back off. Easy 1pt auton…

1 Like