MOTOR
Syntax MOTOR number-or-list power
(MOTOR number-or-list power duration)
MOTOR number-or-list "FALSE
 
Explanation The RCX robot controller contains three motor ports. Motors attached to these ports may be controlled separately or together. They can be turned on in either direction, the direction may be reversed, and seven levels of power may be applied to each motor. A motor can be stopped either immediately, utilizing an internal brake, or more smoothly.

The first input to MOTOR is either the number of the motor port or a list of motor numbers. Valid motor numbers are 1, 2, and 3. The second input is the power level as a percentage between -100 and 100. Negative values cause the motor turn in the opposite direction from positive values. A power level of 0 causes the motors to float, which means that they slow down until they stop. If an immediate stop is needed, use "FALSE instead of a power value which turns the motor(s) off immediately. The RCX motors have 7 levels of power.

An optional, third input of time, measured in milliseconds, may be supplied. If supplied, the motor is turned off automatically after the time has elapsed.

The MOTOR command also works with motors of any other robotics devices supported by Logo. For the number of motors and the possible power levels, use the command ROBOTFACTS.

Examples MOTOR [1 2] 100
(Motors 1 and 2 turn on in forward direction)
MOTOR [1 2] "FALSE
(Motors 1 and 2 are turned off immediately)

TopIndex