Autonomous task Sleep

How do I limit the amount of rotations for my autonomous? This is what I currently have:

 autonomous();

FrontLeft.spin(vex::directionType::fwd, 80, vex::velocityUnits::pct);
BackLeft.spin(vex::directionType::fwd, 80, vex::velocityUnits::pct);
FrontRight.spin(vex::directionType::fwd, 80, vex::velocityUnits::pct);
BackLeft.spin(vex::directionType::fwd, 80, vex::velocityUnits::pct);
LeftIntake.spin(vex::directionType::fwd, 80, vex::velocityUnits::pct);
RightIntake.spin(vex::directionType::fwd, 80, vex::velocityUnits::pct);

}

Well, you are using spin commands. The spin commands never tell the motor when to stop, as you seem to know, so they can be good for things like intakes. But for drive motors I would use the rotateFor or rotateTo commands. These can be found here. Just look at the list until you find rotateFor or rotateTo. These commands allow you to say an encoder count that the motor will go to, and then the motor will automatically stop when it reaches that.

4 Likes