Driving a DC motor using Arduino UNO and L293D driver.
Components required:
1)
Arduino UNO
2)
L293D IC
3)
Breadboard
4)
DC Motor(s)
5)
Connecting wires / jumpers
Connection
Arduino to L293D to DC Motor.
Pinout diagram of L293D IC
Connectivity
1
|
Arduino
|
L293D
|
Motor
|
2
|
D2
|
1A(2)
|
|
3
|
D3
|
1B(7)
|
|
4
|
D4
|
1E(1)
|
|
5
|
|
M1A
|
Terminal 1
|
6
|
|
M1B
|
Terminal 2
|
7
|
|
+VMotor to External Source
|
|
8
|
GND
|
GND
|
|
Arduino program to control the motor
const int M1A = 2;
const int M1B = 3;
const int M1E = 4;
// the setup function runs once when you press reset or power the
board
void setup() {
// initialize digital pin 13
as an output.
pinMode(M1A, OUTPUT);
pinMode(M1B, OUTPUT);
pinMode(M1E, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
//Enable
digitalWrite(M1E, HIGH);
// forward
digitalWrite(M1A, HIGH);
digitalWrite(M1B, LOW);
delay(5000); // wait for 5 seconds
//Reverse
digitalWrite(M1A, LOW);
digitalWrite(M1B, HIGH);
delay(5000); // wait for 5 seconds
}
|
If you are looking for more information about flat rate locksmith Las Vegas check that right away. uno4d
ReplyDeleteExcellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. driver
ReplyDelete