Notifications
Clear all

Having trouble with L298N circuit

3 Posts
2 Users
0 Likes
1,102 Views
(@tperry724)
Member
Joined: 4 years ago
Posts: 33
Topic starter  

Folks,

Below is the code and a wiring diagram for the project I'm working on.  The problem I'm having is no movement of the motor.  The code was just adapted from a previous Dronebot tutorial.  Any help would be appreciated.  This is the first time I've used the L298N.  The jumper for the 5V regulator is in place, which I assumed meant that I did not have to run a wire to +5V - that the 9V battery I'm using would power the L298N.

Thank you,

Tony

 

/* 
DroneBot Workshop 2017
http://dronebotworkshop.com
*/

int enA = 4;
int in1 = 3;
int in2 = 2;
int MotorSpeed1 = 125;

void setup() {
// Set all the motor control pins to outputs
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
}

void loop() {

analogWrite(enA, MotorSpeed1);

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
}

L298N Motor Wiring Diagram 3

 


   
Quote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@tperry724

Posted by: @tperry724

The problem I'm having is no movement of the motor.

You have the motor connected to the wrong side of the L298N.

Edit: - It wouldn't be a bad idea to choose some good names for the PWM pin and direction pins too 😉

Cheers.


   
ReplyQuote
(@tperry724)
Member
Joined: 4 years ago
Posts: 33
Topic starter  

@frogandtoad  Thank you very.  I have much to learn about programming and troubleshooting.  I use magnifying glasses for things up close and it's still hard to read some of the small text printed on the PCBs.  I'll make the change and give it a go.  Have a great week.  And greetings from Pittsburgh PA where we woke up to our first snowfall of the season of about an inch or so. 

Best,

Tony


   
ReplyQuote