The L298N module is a dual H-bridge. A board pin cannot power a motor directly, so the driver sits between them: the board only sends small control signals, and the module switches the motor power. One module drives two DC motors, each in both directions.
Pins
| Group | Pins | What they do |
|---|---|---|
| Motor outputs | OUT1, OUT2 / OUT3, OUT4 | Motor A on OUT1 and OUT2, motor B on OUT3 and OUT4 |
| Motor supply | 12V (VCC_M) and GND | The power the motors use (use your battery, not the board's pin) |
| Logic supply | 5V | Logic power of the module |
| Control | IN1, IN2 / IN3, IN4 | Direction of motor A / motor B |
| Enable | ENA / ENB | Switches a motor on; a PWM signal here sets its speed |
How to drive a motor
For motor A (motor B works the same with IN3, IN4 and ENB):
| IN1 | IN2 | Result |
|---|---|---|
| HIGH | LOW | Forward |
| LOW | HIGH | Reverse |
| LOW | LOW | Stops freely |
| HIGH | HIGH | Brakes |
A PWM signal on ENA sets the speed (a duty cycle of 50 % is about half the speed).

