LESSONMotors & Drivers · Part 4EP.70 · 24 s

Two motors: a robot car

// WHAT YOU WILL LEARN

One L298N, two channels (A = left, B = right); same direction = straight, opposite = spin; every move = IN1–IN4 HIGH/LOW.

// LESSON NOTES

Two motors. One robot car! 🚗🤖

1️⃣ ONE DRIVER, TWO CHANNELS: an L298N has two H-bridges. Channel A (OUT1 + OUT2) drives the left motor, channel B (OUT3 + OUT4) drives the right motor. IN1–IN4 come from the Arduino.

2️⃣ MIX THE WHEELS: both wheels forward → it drives straight. Left wheel back + right wheel forward → it spins left. The opposite → it spins right. No steering wheel needed!

3️⃣ 4 PINS = 1 MOVE:
forward(): IN1 HIGH, IN2 LOW, IN3 HIGH, IN4 LOW
spinLeft(): IN1 LOW, IN2 HIGH, IN3 HIGH, IN4 LOW
Tip: if one wheel turns the wrong way, swap its two motor wires.

📌 Steer by mixing two wheels.

Read the voiceover (transcript)
  1. Two motors. One robot car!
  2. One driver, two channels: A drives the left wheel, B the right.
  3. Both forward? It drives straight. Left back, right forward? It spins left!
  4. In code, every move is just four pins, IN one to IN four, high or low.
  5. Steer by mixing two wheels!
  6. Next: the stepper motor! Follow for part five!

Related lessons