can't power dc motor

i'm new to arduino and i'm trying to control a dc motor.
i'm going according to the " the most complete starter kit" tutorial lesson 29 but it not working for me.

i'm using a circuit like in the this image: Capture hosted at ImgBB — ImgBB
but instead of arduino mega i'm using arduino uno.
when i power the arduino through the usb and the l293d through the 9v batteries noting happens,
but if i change the cable from pin 5 to the + in the breadboard the motor works

this is the code.

const int ENABLE = 3;
const int DIRA = 5;
const int DIRB = 4;

int i;
 
void setup() {
  //---set pin direction
  pinMode(ENABLE,OUTPUT);
  pinMode(DIRA,OUTPUT);
  pinMode(DIRB,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  analogWrite(ENABLE,255); //enable on
  digitalWrite(DIRA,HIGH); //one way
  digitalWrite(DIRB,LOW);
}

9V batteries are totally unsuitable for motors -- they can't supply much current.

Don't use the Arduino 5V output for motors or servos, you can actually damage the Arduino doing that.

You could use a 9V, 1 Ampere or higher "wall wart" power supply for the motor and L293D. Don't forget to connect the grounds.

HI,
You need to connect the gnd of the 293 to the gnd of the UNO so you have a circuit for the control signals.

Tom.. :slight_smile: