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 ![]()






