strange behavior on my first robot with L298

Hi,
Thank you all for your response.
i will start with MorganS

You're building a line-follower, right

No, i'm building an obstacle avoiding robot, but it will follow a maze (constructed by myself)
my Robot need to follow a straight line, otherwise the limit of this maze will be touched.

ScoobyDoo :

I realize you have the battery problem solved, at least it sounds like it

No, it's not battery problem, i'm pretty sure. and till now i didn't understand what was it.
as i explained before, all motors works today, and tomorrow only motors A works, after tomorrow none of my motors works, and the day after all my motors works well.

outsider :

you would need 2 PERFECTLY matched motors with the SAME load to run the same speed for the same voltage

You are right, thank you.

TomGeorge:

I think you have these motors.

Exactly, it looks like this one :slight_smile:

MorganS :

If both of those wheels are in contact with the ground, it will all sort itself out. It looks like a competent kit with appropriate motors for the task.

so you suggest that i need to try to put the wheels ? Ok, i will come back to you

Thanks for you all, but to "resolve" the problem i changed a little bit the speed between Motors A and B. this is my new code :

void MoveForwardMotorRight(int speed)
{
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  analogWrite(enB, speed);
}

void MoveForwardMotorLeft(int speed)
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  analogWrite(enA, speed - 8);
}

void MoveForward(int speed)
{
  MoveForwardMotorLeft(speed);
  MoveForwardMotorRight(speed);
}

Now, when i put the speed at 255 :

motors A1 : 62
motors A2 : 61
motors B1 : 60
motors B2 : 61

i will try to put the wheels now, and come back.