Hey all,
I followed the following connection schematic for a dc motor with an H-bridge
My connection is below.
This is the following code I am running
//www.elegoo.com
//2016.12.12
/************************
Exercise the motor using
the L293D chip
************************/
#define ENABLE 5
#define DIRA 3
#define DIRB 4
int i;
void setup() {
//---set pin direction
pinMode(ENABLE,OUTPUT);
pinMode(DIRA,OUTPUT);
pinMode(DIRB,OUTPUT);
Serial.begin(9600);
}
void loop() {
//---back and forth example
Serial.println("One way, then reverse");
digitalWrite(ENABLE,HIGH); // enable on
for (i=0;i<5;i++) {
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(500);
digitalWrite(DIRA,LOW); //reverse
digitalWrite(DIRB,HIGH);
delay(500);
}
digitalWrite(ENABLE,LOW); // disable
delay(2000);
}
I have videos of whats going on but it seems we cant upload videos. If that is necessary maybe I could upload them to youtube and link them.
I have not connected a battery to the breadboard power supply unit however the motor begins to turn (ie the program runs) though its slow. When i connect the battery it is faster.
Could someone please suggest what could be wrong with my connection or what could be causing the issue?
Edit: I think i can redefine my problem. Why could the motor run when pin 8 on the L293D is not connected to a battery?



