When I press f my Arduino car works perfectly and both motors follow the instructions and go forward, however whenever I press b to go backward Arduino doesn't follow the code at all and moves one motor forward and the other stays still.
if(inputString == "f")
{
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
}
else if(inputString == "b")
{
digitalWrite(3, LOW);
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
}
else if(inputString == "r")
{
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
}
else if(inputString == "l")
{
digitalWrite(3, LOW);
digitalWrite(2, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
} inputString = "";
}