VEX2 Functions Motors and Servos
From ROBOTC API Guide
CORTEX → Functions and Variables → Motors and Sensors
| For more examples and explanations, head over to Motors and Servos Overview! |
| Up to 8 motors and/or servos can be connected to the VEX controller. Motor speeds range from -127 (full reverse) through zero (stopped) up to +127 (full forward). There is a small deadband in the motors from about +15 to -15 |
|
| |||||||
bMotorReflected
| bool bMotorReflected | |
| (bool) Boolean array with one entry for each motor. Indicates that the direction of a motor should be reflected 180 degrees. Useful when mechanical design results in a logical "reversed" condition of a motor. | |
|
getEncoderForMotor
| tSensors getEncoderForMotor(tMotor motorIndex) | |||||||
| (tSensors) Returns the sensor port of the encoder paired to motor port, motorIndex.
|
mapEncoderToMotor
| void mapEncoderToMotor(tMotor motorPort, tSensors I2CPort) | ||||||||||
| (void) Map an I2C sensor port to the motor it belongs to (when using VEX Integrated Encoder Modules). This is taken care of in the Motors and Sensors Setup window.
|
motor
| int motor[tMotor motor] | ||||||
| (int) An array variable with one element for each of the possible motors. This command is used to set the speed (-127 to +127) for a motor. Negative values are reverse; positive forward. Zero is stopped. To drive the motor on port1 at 50% of full power you use the statement motor[port1] = 63; | ||||||
| ||||||
|
motorType
| word motorType[tMotor motor] | ||||||
| (word) An array variable with one element for each of the possible motors. This command is used to read/write the type of the motor in question. | ||||||
| ||||||
|