Control direction and speed for common two-wire DC motors.
Open in compiler →Source code and build tools are available in the protected platform workspace.
How it works
Control DC motor direction and speed through an L298N-style driver.
- Connect IN1/IN2 to direction pins.
- Connect ENA/ENB to the PWM enable pin.
- Use an external motor power supply.
- Share GND between Arduino and motor driver.
Connections
| Pin | Connect to | Note |
|---|---|---|
| D7, D8 | L298N IN1 and IN2 | Controls motor direction. |
| D11 | L298N ENA/ENB | Controls motor speed. Share GND between motor supply and Arduino. |