l298n motor driver problem

Hi
help please i
i have l298n motor driver and tried a lot of things but the motors is not running
and this one of the program i used
const int in1 = 2;
const int in2 = 3;
const int in3 = 4;
const int in4=5;
const int ena=8;
const int enb=9;
int Speed = 200;
void setup() {
pinMode(in1,OUTPUT);
pinMode(in2,OUTPUT);
pinMode(in3,OUTPUT);
pinMode(in4,OUTPUT);
pinMode(ena,OUTPUT);
pinMode(enb,OUTPUT);

}
void loop() {
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
analogWrite(ena,Speed);
digitalWrite(in3,HIGH);
digitalWrite(in4,LOW);
analogWrite(enb,Speed);
}
}

What motors? What are you powering the driver with? Most problems we see are with not enough power, typically a small 9V battery which is no use at all for driving motors.

Steve

i use 4 dc motor 3v..6v
and i use 9v battery for driver

  • also i sperate the power source i give 9v to driver and give arduino power from my pc,my driver create some sound when everything is connected
  • and i give them the same power source and nothing happen

As I said before most 9V batteries are useless for motors. Try more power e.g. 6 x AA batteries.

Also you can't use analogWrite() on pin 8 on most Arduinos. It is not a PWM pin.

Steve

ok i will try it

i try but the same problem
i mesure the voltage in the output i found it 5v it is normal and when i connect a LED ,the LED is good but when i connect a motor the voltage became 0 v (in driver and in output of arduino) i dont know why ?
please help and thank you

Take some more voltage measurements around the circuit to track down where that voltage drop is.

Measure the current taken from the batteries too.

Remember that motors take a lot of current, any power supply that can't provide that current will
drop dramatically in voltage.

i did take voltage measurements around the circuit
the shutdown to 0v happen when i connect motor even just one motor the same problem keep happen all the time
i tried relay module and i use 4 motors,everything seems ok all motors work fine but when i connect even 1 motor to driver or directly to arduino nothing happen i just got 0 v

You need to track down where the voltage drop is. The supply? The wiring? The motor driver?

Did you check the 12V jumper? That makes it possible to provide 5V onboard.
Or do you provide the 5V from an external source, for example your Arduino?
See https://hackerstore.nl/PDFs/Tutorial298.pdf