NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
void RotateMotor ( byte  outputs,
char  pwr,
long  angle 
)
inline

Rotate motor.

Run the specified outputs forward for the specified number of degrees.

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.

Parameters
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.
Examples:
ex_rotatemotor.nxc.