NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
void RotateMotorEx ( byte  outputs,
char  pwr,
long  angle,
char  turnpct,
bool  sync,
bool  stop 

Rotate motor Ex.

Run the specified outputs forward for the specified number of degrees. 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.

outputsDesired 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.
pwrOutput power, 0 to 100. Can be negative to reverse direction.
angleAngle limit, in degree. Can be negative to reverse direction.
turnpctTurn ratio, -100 to 100. The direction of your vehicle will depend on its construction.
syncSynchronise two motors. Should be set to true if a non-zero turn percent is specified or no turning will occur.
stopSpecify whether the motor(s) should brake at the end of the rotation.