Answers.Body: <p>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?</p>
  
  <p>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:</p>
  
  <pre><code># Enable regulation
  PosRegEnable(OUT_A);
  
  # Set target angle
  PosRegSetAngle(OUT_A, 123);
  
  # Busy loop while the motor turns
  while (GetOutput(OUT_A, ActualSpeedField) != 0) {}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-27T20:16:43.790Z
Answers.LastActivityDate: 2015-04-29T23:22:27.697Z
Answers.LastEditDate: 2015-04-29T23:22:27.697Z
Answers.UserDisplayName: jncraton
Body: <p>How can I turn my motor <strong>to</strong> 123 degrees, not <strong>for</strong> 123 degrees?</p>
  
  <p>I tried the <code>PosRegSetAngle("output", "angle")</code> command and didn't work.</p>
  
  <p><a href="http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___output_module_functions_gadbb21feba9bd8d38e9ac7accedc4855a.html" rel="nofollow">Documentation for PosRegSetAngle</a></p>
  
Tags: <nxt><programming><motor><nxc>
Title: Absolute Turning Motor in NXC
UserDisplayName: Timbelion
ThreadText: # Absolute Turning Motor in NXC
  
  (Asked by: username_0 on 2015-04-27)
  
  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](http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___output_module_functions_gadbb21feba9bd8d38e9ac7accedc4855a.html)
  
  **Tags:** nxt, programming, motor, nxc
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-27. Score: 2 | Accepted answer
  
  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) {}
  
  
  ---
  
  