Setting positions on motors in vexcode

Hey Everyone! So I’m having an issue right now where I’m trying to use the position of the smart motor to set a zero point and when I call it I would like it to go the distance and after the distance is near met then go back to the zero point. This is for a lift and I have some code I thought would work but you cannot assign it to the expression.

void liftautofunctions(float x){

Lift2.position(rotationUnits::rev = x);


What you need is motor.rotateTo() function, for example:

Lift2.rotateTo(45.0, rotationUnits::deg, false);  // rotate to 45.deg
vex::task::sleep(2000); // wait 2 sec, while lift is getting there
Lift2.rotateTo(0.0, rotationUnits::deg, false); // send it back to zero