L293DEN only controlling one motor instead of two

Hello i have this problem with the L293DE that no matter how i wire it, it will always move the same motor (upper upper motor of the image given). I'm making a two wheel drive rover, i have tested both DC Motors and they work in both directions. My arduino uno r3 works also so i'm thinking the L293DEN must the the one causing problems!

This is the test code i'm using to make sure the motors work:

// --------------------------------------------------------------------------- Motors
int motor_left0 = 2;
int motor_left1 = 4;
int motor_right0 = 7;
int motor_right1 = 8;

// --------------------------------------------------------------------------- Setup
void setup() {
Serial.begin(9600);

// Setup motors
pinMode(motor_left0, OUTPUT);
pinMode(motor_left1, OUTPUT);
pinMode(motor_right0, OUTPUT);
pinMode(motor_right1, OUTPUT);
}

// --------------------------------------------------------------------------- Loop
void loop() { 

drive_forward();
delay(1000);
motor_stop();

drive_backward();
delay(1000);
motor_stop();

turn_left();
delay(1000);
motor_stop();

turn_right();
delay(1000);
motor_stop();

motor_stop();
delay(1000);
motor_stop();
}

// --------------------------------------------------------------------------- Drive the motors!

void motor_stop(){
digitalWrite(motor_left0, LOW); 
digitalWrite(motor_left1, LOW); 

digitalWrite(motor_right0, LOW); 
digitalWrite(motor_right1, LOW);
delay(25);
}

void drive_forward(){
digitalWrite(motor_left0, HIGH); 
digitalWrite(motor_left1, LOW); 

digitalWrite(motor_right0, HIGH); 
digitalWrite(motor_right1, LOW); 
}

void drive_backward(){
digitalWrite(motor_left0, LOW); 
digitalWrite(motor_left1, HIGH); 

digitalWrite(motor_right0, LOW); 
digitalWrite(motor_right1, HIGH); 
}

void turn_left(){
digitalWrite(motor_left0, LOW); 
digitalWrite(motor_left1, HIGH); 

digitalWrite(motor_right0, HIGH); 
digitalWrite(motor_right1, LOW);
}

void turn_right(){
digitalWrite(motor_left0, HIGH); 
digitalWrite(motor_left1, LOW); 

digitalWrite(motor_right0, LOW); 
digitalWrite(motor_right1, HIGH); 
}

Sorry if my sentence structure isnt right, english is not my first language :stuck_out_tongue:

Start with separate batteries for the Arduino and motors unless the motors don't draw much power. And connect the grounds when using separate batteries. I see no problems in either your code or your schematic. Please post pictures of your actual circuit, preferably multiple pics from different angles.

Isaac96:
Start with separate batteries for the Arduino and motors unless the motors don't draw much power. And connect the grounds when using separate batteries. I see no problems in either your code or your schematic. Please post pictures of your actual circuit, preferably multiple pics from different angles.

ok! will do as soon as i can

Isaac96:
Start with separate batteries for the Arduino and motors unless the motors don't draw much power. And connect the grounds when using separate batteries. I see no problems in either your code or your schematic. Please post pictures of your actual circuit, preferably multiple pics from different angles.

ok, here it is

I see no errors, but let's see if somebody else comes along. Try running the motor that is not working directly from the 9V battery.

Isaac96:
I see no errors, but let's see if somebody else comes along. Try running the motor that is not working directly from the 9V battery.

I already did, that was the first thing that i did. Ill buy an adafruit motor board tomorrow and if i happen to remember ill come here and post the results... Thanks anyways! +Karma for you :slight_smile:

So the non-working motor does or does not work straight from the battery?

Isaac96:
So the non-working motor does or does not work straight from the battery?

both work perfectly when in direct contact with the battery