L298N isn't working properly

Hey everyone, been tyring to make a robo-car for a while and at the moment I’m struggling. Actually I have 2 problems:

  1. When I plug in the arduino(start providing current) , 2 left side wheels are rotating forward and stoping constantly, that takes approximately 6 seconds. Only after that it starts to do whatever in the code is written. It happens only when it gets the current for the first time , for example if don’t plug the cable out and re-upload the code everything goes normal.

  2. I can’t change the speed of the rotating. I watched couple tutorials and learned that I can change the speed of rotation by using pins ENA and ENB(on the photos marked light blue). I don’t even know how to call those things that cover the ENA and ENB(If you know, please tell me). So, in order to change the speed of the wheels i have to remove the cover and connect the wires into those places. The problem is- if I do that the car doesn’t move at all( no matter the speed(0-255) I set ).

I’m using An arduino Mega 2560 and a L298N Bridge

Wires are connected:
(Arduino <-> L298N)

5V <-> +12V
13(PWM) <-> IN1
12(PWM) <-> IN2
11(PWM) <-> IN3
10(PWM) <-> IN4
3(PWM) <-> ENA
4(PWM) <-> ENB

P.S. Sorry for the mess, the wires are too long, but they don’t get stuck in the wheels, of course I’ll have to make them shorter.


And the code:

void setup() {
pinMode(3,OUTPUT);    //ENA
pinMode(4,OUTPUT);    //ENB
pinMode(13,OUTPUT);   //left motors forward
pinMode(12,OUTPUT);   //left motors reverse
pinMode(11,OUTPUT);   //right motors forward
pinMode(10,OUTPUT);   //right motors reverse


void loop() {

analogWrite(3 , 100);         //Setting speed to 100
analogWrite(4 , 255);         //Setting speed to 100

digitalWrite(12,LOW);         //Going Forward

digitalWrite(12,HIGH);        //Going Backward

By default EnA and EnB are connected to 5V by shorting plugs. I think these are the "covers" you're talking about. They must be removed.

Then EnA and EnB are available to use. But none of your pictures show anything connected to them.


You see, the problem is if I remove the short plug ENB, connect the wire to the lower pin (there is 2 of them) AND leave the short plug ENA untouched then the right side wheels(ENB) don't work at all, but the left side wheels(ENA) are acting in the way I described earlier in (1.) problem.

If I try to do vice versa(ENA connected with wires and ENB left with short plug) neither of the sides work. The same result occurs if both(ENA and ENB) are connected.

Maybe there is something I should do with the upper ENA and ENB pins?