Before use, the digital and motor ports need to be configured, this is done by passing structures with configuration information to the following functions.
vexDigitalConfigure(vexDigiCfg *cfg, int16_t cfg_num)
vexMotorConfigure(vexMotorCfg *cfg, int16_t cfg_num)
This is usually done in the vexUserSetup function which is called part way through the initialization process. Here is an example of use.
Digital pins are configured as follows
- pin name
- pin function
- digital input
- digital output
- sonar with return values in cm
- sonar with return values in inches
- quadrature encoder
- pin configuration - depends on function
- For Sonar sensors
- For Quad encoders
- first encoder input
- second encoder input
- function channel
Motors are configured as follows
- Motor port
- Motor type
- 393 motor in Torque mode
- 393 motor in speed mode
- 269 motor
- Motor direction (direction the positive command values cause the motor to turn)
- Sensor assigned to this motor, this should be one of the following
- kVexSensorNone - no motor position sensor
- kVexSensorQuadEncoder - a quadrature encoder used for motor position feedback.
- kVexSensorIME - An IME used as motor position feedback.
- Sensor channel