hi, i am building a 4wd arduino car, I want it to move in straight line and change direction for 5s intervals using arduino l298n motor driver. The forward movement works fine. However, for the reverse only right side of motors spin, left side doesnt move, here is my code:
// left side connections
int in1 = 3; //in1 to pin 3
int in2 = 11; //in2 to pin11
// right side connections
int in3 = 12; //in3 to pin12
int in4 = 13; //in4 to pin13
//pin 4-10 are connected to liquid crystal display
void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}
void loop() {
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
delay(5000);
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
delay(5000);
}
I'm sure all wiring and connections are right, what could be the issue?