How would I make a void with instead of using time as the interval using turns

void goForward(int x){
LF.setPosition(x,turns);
RF.setPosition(x,turns);
RB.setPosition(x,turns);
LB.setPosition(x,turns);
LF.stop();
RF.stop();
LB.stop();
RB.stop();
}
Right now I have this but when I try to do something it doesnt work in other words it doesnt move at all. I don’t have any errors either so I don’t know what it could be

setPosition is a command that sets the internal encoder position. It does not tell the motor to move. You have valid commands, but they aren’t for the purpose you want, which explains why it doesn’t move at all and you have no errors. You should use a command like rotateTo or rotateFor. https://api.vexcode.cloud/v5/html/classvex_1_1motor.html#a9d5cc1a29034fec1a7828df11cff2b2f
That is one of the tricky things in coding anything. The compiler finds errors in the code, not in how the code performs.

3 Likes