NXC Version 1.2.1 r5
Rotate motor Ex with PID factors.
Run the specified outputs forward for the specified number of degrees. Specify proportional, integral, and derivative factors. Also specify synchronization, turn percentage, and braking options. Use this function primarily with more than one motor specified via the outputs parameter.
The motor API functions are thread-safe and blocking on the motor resource(s) requested. If you call RotateMotor(OUT_AB, 75, 3600) then no other thread will be able to control motors A and B until the already executing RotateMotor function finishes. But now you can safely call RotateMotor(OUT_A, 75, 3600) on one thread and RotateMotor(OUT_B, 75, 720) on another simultaneously executing thread without having program errors or erratic motor behavior.
Since the functions do not know at compile time which port is being utilized when you use a variable as the port parameter, the RotateMotor functions acquire all three motor port resources for the duration of their operation in that case. So you can safely call RotateMotor using a variable for the port parameter on two simultaneously executing threads but one of the two calls will be blocked until the first one has completed executing.
|outputs||Desired output ports. Can be a constant or a variable, see Output port constants. If you use a variable and want to control multiple outputs in a single call you need to use a byte array rather than a byte and store the output port values in the byte array before passing it into this function.|
|pwr||Output power, 0 to 100. Can be negative to reverse direction.|
|angle||Angle limit, in degree. Can be negative to reverse direction.|
|turnpct||Turn ratio, -100 to 100. The direction of your vehicle will depend on its construction.|
|sync||Synchronise two motors. Should be set to true if a non-zero turn percent is specified or no turning will occur.|
|stop||Specify whether the motor(s) should brake at the end of the rotation.|
|p||Proportional factor used by the firmware's PID motor control algorithm. See PID constants.|
|i||Integral factor used by the firmware's PID motor control algorithm. See PID constants.|
|d||Derivative factor used by the firmware's PID motor control algorithm. See PID constants.|