I have recently bought a L298N motor driver and used it to control two 12V Geared Motor (300 RPM), but on connecting the two motors and a 12v Battery only one motor is working properly...
The Code is-
const int IN1 = 7;
const int IN2 = 6;
const int IN3 = 5;
const int IN4 = 4;
//const int ENA = 9;
//const int ENB = 3;
void setup() {
pinMode (IN1, OUTPUT);
pinMode (IN2, OUTPUT);
pinMode (IN3, OUTPUT);
pinMode (IN4, OUTPUT);
//pinMode (ENA, OUTPUT);
//pinMode (ENB, OUTPUT);
// put your setup code here, to run once:
Welcome to the forum! Please have a look at How to use the forum. And edit your post to have code tags.
Why did you comment out the ENA and ENB part?
And more likely, the error is in the wiring you did not post So please post a circuit diagram. That is NOT a Fritzing breadboard mess! We rather see a photo of a hand drawn schematic (or of course a real CAD schematic).
Which motor, the one on Out1/2 or the one on Out3/4? And if you swap the two motors over does the fault stay on the same L298 output pins or move with the motor?
septillion:
Why did you comment out the ENA and ENB part?
I was performing a test to check whether the l289n as well as the motors work or not.
In the description it said that for the testing code i did not need the ENA and ENB part, that is why I commented it for later use.
I also noticed that on using the L298N for the first time, on switching on the power supply(12v 2A) the left motor automatically started working and on uploading the code for both the motors to work simultaneously the left motor stopped and the right motor started moving, on switching off my arduino again the right would stop and the left would start...
That is a bit what we mean by Fritzing mess... Thing is, without having (or Googling) that board we have NO idea what all the connections on the board do...
Abheek:
In the description it said that for the testing code i did not need the ENA and ENB part, that is why I commented it for later use.
The description isn't very clear in my crystal ball Aka, if you start talking about stuff like that, post it! Same goes for not telling us you use a L298 break out board. And yeah, it has jumpers which you can use to fix enable when not used, are they placed?
And uhm:
slipstick:
Which motor, the one on Out1/2 or the one on Out3/4? And if you swap the two motors over does the fault stay on the same L298 output pins or move with the motor?
12volt on the 5volt pin can't be good.
But then again, Fritzing is never what it really is.
Post a real picture of your setup, and edit your original post with code tags (as asked in post#1).
Read the forum guidelines if you don't know how to do that.
Leo..