Difference between rotate for and rotate to

Hi, I am new to v5. what is the difference between .rotateFor and .rotateTo?

Each V5 motor has a built-in rotation encoder that counts when motor rotates, thus you always know how much it rotated from the zero position, when motor was turned on.

rotateTo() functions try to reach the absolute target relative to the zero position.

rotateFor() functions set target position based on the current encoder value + argument to the function.

You can also reset zero position at any time with a call to resetPosition() function.

See V5 online programming reference for the motor class:

https://api.vexcode.cloud/v5/html/classvex_1_1motor.html

1 Like