Dual H-Bridge Motor Driver - Not working

Hey I am new here, I am not that great with arduino.

I am trying to control two motors with the L298N Dual H-Bridge Motor Driver. It doesn't seen to work.

Here's how I connected it.
Pins 7,6,3 and 2 of the arduino are connected to IN1,IN2,IN3 and IN4 respectively.
I got one motor connecting each side of the motor driver. I got one battery supply(8*AA), the positive side is connected to vcc and the ground is connected to GND. I also connected the GND of the arduino to the GND of the motor driver.

When I run the program. Nothing happens. I might be missing something or doing something silly

Here are some pics.
http://postimg.org/image/q95k78xo9/
http://postimg.org/image/mr25k2qij/
http://postimg.org/image/58to60kib/
http://postimg.org/image/6e4v6iump/
http://postimg.org/image/5d9bd7u1r/
http://postimg.org/image/a8ubzo6lv/

The code I am using is
int IN1 =7;
int IN2 =6;
int IN3 =3;
int IN4 =2;

void setup()
{
//set all of the outputs
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}

void loop()
{
digitalWrite(IN1,HIGH);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,HIGH);

}

Thanks.

You need to hook up the EN pins and make them high to enable the motors.

The attached shows the EN pins driver by Arduino digital pins but that's not compulsory: you can hardwire them to 5V instead.

2 motors L298 small.png

PS making the IN pins all high in fact applies the brake. You need to make the pair for a motor high / low or low / high for it to turn in each direction.

Hi Mazzz,
Setting all the pins HIGH does NOT make the motors work?? you need one pin HIGH the other LOW, the other motor needs the pins connected in reverse to this so one motor spins CW and the other CCW (as it's on the other side of the chassis). Also as Jimbo says you have'ent done anything with the ENABLE inputs these usually need to be set HIGH to ENABLE each motor.
If you control pins are not PWM pins, then you can use the ENABLE pins for this too, I usually combined both on one PWM pin.

The L298 is a little old hat now, but works, but you will lose about 2v on the output. Something based on the DRV883/35 is much better, for speed etc.

I have build a few bots, you can see them here:www.melsaunders.co.uk

I wish people would just upload a couple of decent images! I don't really want to go to strange websites, viewing more images then I need too.

Regards

Mel.

Hi Mazz,
i am even newer than you here))

here is a link that might help . (i hope)

http://tronixlabs.com/news/tutorial-l298n-dual-motor-controller-module-2a-and-arduino/

as reply above you need one pin high and other one low , else motor does nothing.
(also: you made connection at ground/gnd of shield and arduino ??)

was just working with this shield

hope it helps you a little, its my first "project" with this shield and arduino.

Thanks for the reply guys. Good advice. Manage to get them both working!

One more question not sure if i should make a new thread for it but let me know.
Is it possible to connect four motors and control each motor. I want to make a car which will have four wheels and each wheel will be controlled by a motor. Backwards and forwards is simple, but turning left and right is an issue. Anyway pass this?

Hi Mazzz,
Turning is simple just drive one motor forwards the other in reverse. ie. Turning left, left motor in reverse, right motor forward, it's as simple as that!! Perhaps not so with 4 wheels/motors...

If you want 4 motors you need two motor shields?? I have never buid a 4 wheeler as I don't see any advantage and driving it might be a proglem, having said that there are a lot of 4WD buggies around.

If you had a better motor shield then perhaps you could drive both left motors on one channel and the right on the other, but you would need something better then the L298/293 something that can deliver a few Amps..

Regards

Mel.