01Why a driver
MCU pins deliver tens of milliamps; motors need amps. The L298N's H-bridge isolates the MCU and lets you reverse direction by flipping two control pins.
02Pinout
- IN1/IN2 → motor A direction.
- IN3/IN4 → motor B direction.
- ENA/ENB → PWM speed (remove jumper).
- 12V/GND → motor supply, 5V regulator on board for ≤12 V input.
03Code skeleton
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); analogWrite(ENA, 200); — spin motor A forward at ~80% duty.
04Heat & limits
L298N drops ~2 V across its outputs and gets hot under load. For motors over 1 A use a heatsink, or switch to a modern TB6612 / DRV8833 for less waste heat.



