Hi,
I am newbie to Arduino world, and this is my first experiment, and ofcourse "Something went wrong!!". Need your help gurus. I have Uno board, connected two DC motors, Enable 1 & 2from L293D is connected to +5v of Uno boards +5v out. The motor pins motorPin_A1,motorPin_A2 are working/driving the motors in both the directions as per the code. But the motor pins motorPin_B1 and motorPin_B2 are high, the LOW setting is not taking any effect, so it always rotates in the same direction.
I have connected a 9v battery in the 8th pin of L293D to drive the motors. The breadboard connection image is attached with this thread. Please help me to debug/identify this issue. Thanks for your valuable time.
CODE:
//Motor A
const int = 5; // Pin 14 of L293
const int motorPin_A2 = 6; // Pin 10 of L293
//Motor B
const int motorPin_B1 = 9; // Pin 7 of L293
const int motorPin_B2 = 10; // Pin 2 of L293
//This will run only one time.
void setup(){
//Set pins as outputs
pinMode(motorPin_A1, OUTPUT);
pinMode(motorPin_A2, OUTPUT);
pinMode(motorPin_B1, OUTPUT);
pinMode(motorPin_B2, OUTPUT);
}
void loop(){
digitalWrite(motorPin_A1, LOW);
digitalWrite(motorPin_A2, HIGH);
digitalWrite(motorPin_B1, LOW);
digitalWrite(motorPin_B2, HIGH);
delay(2000);
digitalWrite(motorPin_A1, LOW);
digitalWrite(motorPin_A2, LOW);
digitalWrite(motorPin_B1, LOW);
digitalWrite(motorPin_B2, LOW);
delay(2000);
digitalWrite(motorPin_A1, HIGH);
digitalWrite(motorPin_A2, LOW);
digitalWrite(motorPin_B1, HIGH);
digitalWrite(motorPin_B2, LOW);
delay(2000);
digitalWrite(motorPin_A1, LOW);
digitalWrite(motorPin_A2, LOW);
digitalWrite(motorPin_B1, LOW);
digitalWrite(motorPin_B2, LOW);
delay(2000);
}