Skip to main content

DC Motors with Encoder

Back to article list

Note: The dot (•) on the motor port indicates the correct side for connecting the ground (GND) wire, which is usually black or sometimes brown in certain motors or servos. Additionally, DC Motors with Encoders require an external battery power source to function properly.

Sample Code

Hardware Connection: Connect the DC Motor with encoder to the M1 port of the MATRIX Mini R4.

Result: The motor connected to M1 starts to move with 50% of speed. After 2 seconds the motor will move with 80% of speed for 1 second. After 4 times, the motor will be stopped and the degrees of rotation will be shown on the OLED.