Spivey
Published © MIT

Driving a DC Motor with an Arduino & the L293D Motor Driver

In this tutorial, we'll be looking at how to power and drive a DC motor with an L293D and an Arduino.

BeginnerFull instructions provided30 minutes14,834
Driving a DC Motor with an Arduino & the L293D Motor Driver

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
DC motor (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Wia
Wia
Arduino IDE
Arduino IDE

Story

Read more

Code

Arduino IDE

Arduino
// Define the pin numbers
int motorPin1 = 6;
int motorPin2 = 7;

void setup() {
  // Set the pin modes of the above IO pins to OUTPUT
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
}

void loop() {
  // Turn the motor in one direction
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, HIGH);
}

Credits

Spivey

Spivey

82 projects • 59 followers
Tourist in a Tutu || US Born || Melbourne/Mexico/California Raised || New Yorker at ❤️ || SF to Dublin to be COO of Wia the best IoT startup

Comments