RCX: Motors
Processes and constants to work with motors and the RCX's three output ports.
MOTOR - Commands to set the motor mode for directionMOTOR.BACKWARD - BackwardMOTOR.FLOAT - Float (stops the motor, but allows the motor to continue turning)MOTOR.FORWARD - ForwardMOTOR.STOP - Stop (actively stops the motor, brake)MOTOR - Constants to refer to motors connected to each of the three output ports on the RCX, labeled A through CMOTOR.A - Port AMOTOR.B - Port BMOTOR.C - Port CMOTOR.CMD - Commands to the motorsbackward - Go backwardfloat - Stop the motor (float)forward - Go forwardstop - Stop the motor (braked)MOTOR.MODE - Motor commandsmotor - Motor process, reads commands from a channelmotor.addr - Motor addressesmotor.control - Motor control process, makes the neccessary calls and displays indicators matching motor activityMOTOR.MODE
DATA TYPE MOTOR.MODE
Motor commands.
MOTOR
Commands to set the motor mode for direction
MOTOR.FORWARD
VAL MOTOR.MODE MOTOR.FORWARD
Forward
MOTOR.BACKWARD
VAL MOTOR.MODE MOTOR.BACKWARD
Backward
MOTOR.STOP
VAL MOTOR.MODE MOTOR.STOP
Stop (actively stops the motor, brake)
MOTOR.FLOAT
VAL MOTOR.MODE MOTOR.FLOAT
Float (stops the motor, but allows the motor to continue turning).
MOTOR
Constants to refer to motors connected to each of the three output ports on the RCX, labeled A through C.
MOTOR.A
VAL INT MOTOR.A
Port A
MOTOR.B
VAL INT MOTOR.B
Port B
MOTOR.C
VAL INT MOTOR.C
Port C
MOTOR.CMD
PROTOCOL MOTOR.CMD
Commands to the motors
forward
forward; INT
Go forward.
INT |
|
Speed for the motor, 0-7 |
backward
backward; INT
Go backward.
INT |
|
Speed for the motor, 0-7 |
stop
stop
Stop the motor (braked)
float
float
Stop the motor (float)
motor.addr
VAL [3]INT motor.addr
Motor addresses.
motor.control
PROC motor.control (VAL INT port, VAL MOTOR.MODE mode, VAL INT power)
Motor control process, makes the neccessary calls and displays indicators matching motor activity.
VAL INT |
port |
The motor port to control. |
VAL MOTOR.MODE |
mode |
The mode to set the motor to. |
VAL INT |
power |
The speed of the action. (not relevant for stop, float) |
motor
PROC motor (VAL INT port, CHAN MOTOR.CMD cmd?)
Motor process, reads commands from a channel.
VAL INT |
port |
The port (MOTOR.A-C, or 0-2) to control. |
CHAN MOTOR.CMD |
cmd |
The channel the process accepts commands on. |