NXC_MotorControl

Sends advanced motor-command to the NXC-program MotorControl on the NXT brick,

Contents

Syntax

NXC_MotorControl(Port, Power, TachoLimit, SpeedRegulation, ActionAtTachoLimit, SmoothStart)

NXC_MotorControl(Port, Power, TachoLimit, SpeedRegulation, ActionAtTachoLimit, SmoothStart, handle)

Description

The NXC-program "MotorControl" must be running on the brick, otherwise this function will not work. It is used to send advanced motor commands to the NXT that can perform better and more precise motor regulation than possible with only classic direct commands.

While one command is being executed (i.e. when the motor is still being controlled if a TachoLimit other than 0 was set), this motor cannot accept new commands. Use the NXTMotor classes command .WaitFor to make sure the motor has finished it's current operation, before sending a new one. If the NXC-program receives a new command while it is still busy, a warning signal (high beep, then low beep) will be played.

The command StopMotor (or NXTMotor's method .Stop) is always available to stop a controlled motor-operation, even before the TachoLimit is reached.

Input:

Limitations

If you send a command to the NXT without waiting for the previous motor operation to have finished, the command will be dropped (the NXT indicates this with a high and low beep tone). Use NXTMotor classes WaitFor to make sure the motor is ready for new commands, or stop the motor using NXTMotor's method .Stop.

The option SmoothStart in conjunction with ActionAtTachoLimit == 'Coast' is not available. As a workaround, disable SmoothStart for this mode.

With ActionAtTachoLimit = 'Coast' and synchronous driving (two motors), the motors will stay synced after movement (even after .WaitFor() has finished). This is by design. To disable the synchonization, just use StopMotor(port, 'off').

See also

WaitForMotor, NXT_SetOutputState, NXT_GetOutputState, NXC_ResetErrorCorrection, MOTOR_A, MOTOR_B, MOTOR_C%

Signature