How to use encoder Vex V5

I am using the X button and the while command to spin the motor. The thing is I want the motor to stop after 1000 degrees. How can I do that?

If using VEXcode V5 text, motor::rotateFor is your friend here.

If using VEXcode V5 blocks, you can use this block:
42%20PM

1 Like

thank you but I am a total amateur when it comes to vex v5. I use vex v5 text. Can you show me an example of how to use it?

1 Like

The latest version of the VEXCode comes with a lot of built-in examples and tutorials:

https://www.vexrobotics.com/vexcode

Also, you may want to browse through the Getting Started section on help.vex.com:

https://help.vex.com/category/130-getting-started

There are several sample programs that demonstrate how to use V5 Smart Motor built-in encoders. For example this one:

As @holbrook you need to use rotateFor() function:

//Rotate the Left and Right Motor for degreesToRotate.
LeftMotor.rotateFor(degreesToRotate, rotationUnits::deg, false); //This command must be non blocking.
RightMotor.rotateFor(degreesToRotate, rotationUnits::deg); //This command is blocking so the program will wait here until the right motor is done.
//The motors will brake once they reach their destination.
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.