12.1 DC Motor
The DC gear motor to be used is of 3~5V, which looks as:
In order to estimate the race car's speed, we also provide a speed encoder for each DC motor.
DC Motor + Speed Encoder
Clearly, two welding spots come with the DC motor, which we need to weld out the electrical wires manually.
DC Motor with Soldered Wire
The code can be found at Examples_Arduino - adafruit - _001_DCMotor - _001_DCMotor.ino You can also refer to Adafruit's official website at https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/overview.
Adafruit Arduino - Lesson 13. DC Motor
int motorPin = 3;
while (! Serial);
Serial.println("Speed 0 to 255");
int speed = Serial.parseInt();
if (speed >= 0 && speed <= 255)
We will use 4 L298N DC motors in our race car. Please refer to Chapter 15.1 - 4-Wheel Driven Using 4 DC Motors for more details.