How can I turn my motor to 123 degrees, not for 123 degrees?
I tried the PosRegSetAngle("output", "angle")
command and didn't work.
Bricks is a question and answer site for LEGO® and building block enthusiasts. It only takes a minute to sign up.
Sign up to join this communityHow can I turn my motor to 123 degrees, not for 123 degrees?
I tried the PosRegSetAngle("output", "angle")
command and didn't work.
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) {}