The port configuration for a motor.
EV3 motors have the following wires:
- White = Motor + (should connect to an L298N motor driver)
- Black = Motor - (also should connect to a motor driver)
- Red = Ground
- Green = 5V (to drive the encoders)
- Yellow = encoder A
- Blue = encoder B
For this structure, the following values should be used:
- Enable: the PWM out pin connected to the corresponding enable pin of the L298N for this motor
- In1: the digital out pin connected to the L298N corresponding to the positive input (white wire) of the motor
- In2: the digital out pin connected to the L298N corresponding to the negative input (black wire) of the motor
- EncoderA: the digital input pin connected directly to the encoder A (yellow) wire of the motor
- EncoderB: the digital input pin connected directly to the encoder B (blue) wire of the motor
- Examples
- motor.cpp, and touchSensor.cpp.