How to add time delay to autonomous

I am trying to have my intakes and my drive train move at the same time. I want my intakes to start before my drivetrain though. Anyone know how to do that?

You would first have to start your intakes making sure that the program isn’t waiting for the motors to have completed the action prior to going to the next line of code. Then, you would use a wait command and then run your drivetrain.
To tell the program to not wait for the motor to complete, simply put:

motor1.spinFor(numberofRotation, turns, velocity, vex::velocityUnits::pct, false);

The false at the end just tells the program to not wait for the motor.

3 Likes

Thank you, that helps a lot

If you’re using vexcode you can use task::sleep(time) as a delay function, where time is in milliseconds. In pros you can use pros::delay(time)

2 Likes