Problem with connecting dc motors to L293d motor shield

Hello everyone ,
Im trying to connect 2 dc motors and a servo to l293d motor shield+arduino mega2560 ( rev3) . The arduino is powered by pc and a motor shield is powered by 6x1.5v AA batteries . But no matter how hard im trying , no matter the port they do not work , despite the fact that they are both work perfectly from direct contact with AA battery .

Right now im trying to make at least one of them work .

:

The code that im using right now

#include <AFMotor.h>

AF_DCMotor motor(1);

void setup() 
{
	//Set initial speed of the motor & stop
	motor.setSpeed(200);
	motor.run(RELEASE);
}

void loop() 
{
	uint8_t i;

	// Turn on motor
	motor.run(FORWARD);
	
	// Accelerate from zero to maximum speed
	for (i=0; i<255; i++) 
	{
		motor.setSpeed(i);  
		delay(10);
	}
	
	// Decelerate from maximum speed to zero
	for (i=255; i!=0; i--) 
	{
		motor.setSpeed(i);  
		delay(10);
	}

	// Now change motor direction
	motor.run(BACKWARD);
	
	// Accelerate from zero to maximum speed
	for (i=0; i<255; i++) 
	{
		motor.setSpeed(i);  
		delay(10);
	}

	// Decelerate from maximum speed to zero
	for (i=255; i!=0; i--) 
	{
		motor.setSpeed(i);  
		delay(10);
	}

	// Now turn off motor
	motor.run(RELEASE);
	delay(1000);
}

Please help , i feel my sanity slowly leaving me

Woah! First post, proper use of code tags AND you posted an image properly. Karma++

The l293d is old technology and looses voltage. There are more modern motor drivers that do better.
Pololu has a great collection of modern, efficient motor drivers, at very reasonable prices
Maybe this one?
But here are more for you to choose from

But if you are testing an unloaded low current motor like in your image, I would think that you would get some response even from the l293d

Do you have a DMM? Are you getting anything to the motor?

vinceherman:
Woah! First post, proper use of code tags AND you posted an image properly. Karma++

The l293d is old technology and looses voltage. There are more modern motor drivers that do better.
Pololu has a great collection of modern, efficient motor drivers, at very reasonable prices
Maybe this one?
But here are more for you to choose from

But if you are testing an unloaded low current motor like in your image, I would think that you would get some response even from the l293d

Do you have a DMM? Are you getting anything to the motor?

Thank you for these options , but unfortrunatly this shield was chosen because of its simplicity (connect this to this , this to this and you are good to go) and i know almost nothing in arduino at all (
Yes , i have a dmm . On the battery it is 9.6 , on the servo 4.5 but on the motors it is always 0. No matter what . Though on the ground pins it is somehow 1.1
Thats what makes me so confused . Although i think that i will take adafruit motor shield v2 . It has TB6612 instead of L293d . Is it better or still meh ?

From your picture it looks like you have the VIN jumper bridged.

For power supplied by the barrel jack on the mega then you need the jumper.

For power supplied by the terminals on your shield (like you have hooked up) then you need to remove the jumper.

You can tell if there is power to supply the motors by the green LED being on.

justone:
From your picture it looks like you have the VIN jumper bridged.

For power supplied by the barrel jack on the mega then you need the jumper.

For power supplied by the terminals on your shield (like you have hooked up) then you need to remove the jumper.

You can tell if there is power to supply the motors by the green LED being on.

Unfortunatly , your eyes are lying to you . The jumper was removed