DC motor runs only one direction with an H-bridge driver

One direction working means the driver and motor are alive, so the fault is in one direction signal. Check the two input pins and the code that sets them.

What the message means

An H-bridge needs one input high and the other low to drive the motor. Swapping them reverses it. If one combination fails, one input never changes.

Fix it in this order

  1. Test each input pin with a simple sketch that sets one high and one low, then swaps them.
  2. Check the wire and solder on both direction inputs.
  3. Make sure PWM is applied to the enable pin, or to the correct input, as your driver expects.
  4. Check the pin number in code matches the wire. Swapped numbers make a direction dead.
  5. Confirm the pin supports output. On an ESP32, GPIO 34 to 39 are input only.
  6. Try the other channel. If it works there, the first channel may be damaged.

Why it happens

If a motor runs only one way, one direction input is stuck or the code never sets it. With an H-bridge such as the L298N or TB6612FNG the direction is set by two input pins: one high and one low in one direction, reversed for the other.

Test with a simple sketch that sets IN1 high and IN2 low, waits, then swaps them. Check each input with a multimeter or an LED, and look for a loose wire or a damaged driver channel.

If you see this, do this

You seeDo this
Forward works, reverse does notThe second input pin has no signal.
Both directions fail on one channelCheck that channel enable and supply.

L298N motor not spinning, L298N vs TB6612FNG.

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.