Connecting L928N with DC motor and arduino

I've been using the guide here: https://www.youtube.com/watch?v=kv-9mxVaVzE

I have Digital pin 9 connected to ENB on the L928N board (which is what it looked like in the video) Pin 8 and 9 are in IN4 and IN3 respectively. Power is being received by everything fine, and the code I am using is this:

void setup() 
{
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
}

void loop() 
{
digitalWrite (8, HIGH);
digitalWrite (7, LOW);
analogWrite (90, 80);
delay (1000);
digitalWrite (8, LOW);
digitalWrite (7, HIGH);
analogWrite (90, 80);
delay (1000);
}

Yet for some reason nothing happens, can anyone help?

You're pwm-ing pin 90....

??

What he is saying is analogWrite(90,80) is writing to pin 90 (Which doesn't exist). Change to analogWrite(9, 80).

Hi alka, thanks for pointing that out!

I've changed the code to write to pin 9 (I did have that originally, but accidentally put a '0' in when I was trying to change the motor speed).

Still nothing is happening with the motor though...

I have tried plugging pin 8 and 9 in IN1 and IN2 to see if that changed anything, but it doesn't.

Can anyone spot anything wrong with the code or the way I have connected it?

Motor is connected to the OUT1/2 of the L298N. the current code is:

void setup() { pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); }

void loop() { digitalWrite (8, HIGH); digitalWrite (7, LOW); analogWrite (9, 80); delay (1000); digitalWrite (8, LOW); digitalWrite (7, HIGH); analogWrite (9, 80); delay (1000); }

Too little info to guess,

What is motor 1/2 ? Is that what the output says? the 298 if for two motors. Make sure you aren't switching up the sides

Do you have a common ground between arduino and board?

--If you are using in1 , in2 (for arduino pins 7,8) the pwm should be applied to enA ( arduino 9) and the motor should be plugged into motor 1 (A).

--If using in3, in4 pwm should be applied to enB and motor in number 2 channel (B).

You need to give us a schematic, showing all the connections including power and grounds.

Should be something like this, of course with your Arduino pins not mine.

2 motors L298 70pc.png

edit… I see from the you tube your 298 is a module not a loose chip, so slightly different from my schematic. Basically the same though, except you don’t need to provide the 5V to the 298 chip like I show since that’s taken care of by the module.

What voltage are you proving for the motors? The 298 drops at least 2V, and up to 5V at higher current, so you might not be getting enough voltage to the motor.

You do have the ground from the module to the Arduino?

Thanks for the very helpful responses! I've managed to get it working now :) This is all new to me, so the help is massively appreciated :)

How did you managed to get it working? Can i have the programming and how you connect the L928N to your arduino?