2

How can I turn my motor to 123 degrees, not for 123 degrees?

I tried the PosRegSetAngle("output", "angle") command and didn't work.

Documentation for PosRegSetAngle

1 Answer 1

2

PosRegSetAngle should set the position of the motor relative to the position the motor was in when regulation was enabled. In what way didn't it work when you tried this?

It sounds like you may be asking how to wait for the rotation to finish. I'm not sure if there is a built-in way to do this in NXC or not, but I think that something along these lines should get you there:

# Enable regulation
PosRegEnable(OUT_A);

# Set target angle
PosRegSetAngle(OUT_A, 123);

# Busy loop while the motor turns
while (GetOutput(OUT_A, ActualSpeedField) != 0) {}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.