L293D Motor Driver Guide

A step-by-step tutorial to control motors with the L293D IC.

What Is the L293D Motor Driver?

The L293D is a popular H-bridge motor driver IC that allows you to control the speed and direction of up to two DC motors simultaneously.

Pinout of the L293D

Arduino Example Code


#define EN1 9
#define IN1 8
#define IN2 7

void setup() {
    pinMode(EN1, OUTPUT);
    pinMode(IN1, OUTPUT);
    pinMode(IN2, OUTPUT);
}

void loop() {
    digitalWrite(IN1, HIGH);
    digitalWrite(IN2, LOW);
    analogWrite(EN1, 128);
    delay(2000);

    digitalWrite(IN1, LOW);
    digitalWrite(IN2, HIGH);
    analogWrite(EN1, 128);
    delay(2000);
}