Using a 24 volt dc motor with an arduino and L298N module

Hi,

I'm trying to power a 24 volt motor using an arduino and L298N module. In the code it shows me no errors but when I run it, nothing is moving. I was originally using 2 motors, but I am just trying to get one up and running. This is my code.

void setup() {

pinMode(enA,OUTPUT);
//pinMode(enB,OUPTUT);
pinMode(in1,OUTPUT);
pinMode(in2,OUTPUT);
//pinMode(in3,OUPTUT);
//pinMode(in4,OUPTUT);

}

void turnOnMotors(){
//Turns on Motor A
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
//Turns on Motor B
//digitalWrite(in3,HIGH);
//digitalWrite(in4,LOW);
}

void turnOffMotors(){
//Turns on Motor A
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
//Turns on Motor B
//digitalWrite(in3,LOW);
//digitalWrite(in4,LOW);
}

void moveForward(){
//set Motor speed to 200 in all motors
analogWrite(enA,200);
//analogWrite(enB,200)
}

void loop() {
turnOnMotors();
moveForward();
delay(5000);
turnOffMotors();

}

Have you done the tutorial on the L298N? Please post a copy of your wiring diagram.

Paul

By the way, that can't be your entire program. The whole thing would be nice.

If you post the complete program we can see useful things like if you’re using the correct types of pins.

BTW there are dozens of very different Arduinos. Which one are you using. A Uno perhaps?

Steve

lzegelstein:
Hi,

I'm trying to power a 24 volt motor using an arduino and L298N module. In the code it shows me no errors but when I run it, nothing is moving. I was originally using 2 motors, but I am just trying to get one up and running.

Please give full details of the hardware involved - motor, power supply, L298 module.

Posting in the programming section of the forum clearly shows you have failed to suspect the
hardware, which is usually the problem with motors - people severely underestimate the current
and power needed by even small motors. 24V motors can be upto several kW, so my first guess
is the motor needs lots more current than you suspect.