PWM in DC motor

I wrote this program to control the motor direction and speed.

int pinp = 11;
int pin1 = 10;
int pin2 = 9;
void setup()
{
  Serial.begin(9600);
  pinMode(pinp, OUTPUT);
  pinMode(pin1, OUTPUT);
  pinMode(pin2, OUTPUT);
}
void loop()
{
    digitalWrite(pin1, LOW);
  digitalWrite(pin2, HIGH);
  analogWrite(pinp,250);
}

i used L293D IC for H bridge. i connected pin number 1 to 11 in Arduino, and 8 to 5V in Arduino respectively . when i change the value in analogWrite there is no change in output speed, the motor kept running even i changed the value to "0".
my questions are,

what is the problem actually, is there any problem in my connection and should i connect any external power supply to pin number 8 instead of 5V from Arduino for PWM

kishorekumar:
i connected pin number 1 to 11 in Arduino, and 8 to 5V in Arduino respectively . when i change the value in analogWrite there is no change in output speed, the motor kept running even i changed the value to "0".

You connect pin 1 (Enable 1) of the L293D to Pin 11 of the Arduino.
You connected pin 8 (Vs) of the L293D to +5 of the Arduino.

How are the other 14 pins connected?

L293D Arduino
1 11
2 10
3 motor
4 GND
5 GND
6 motor
7 9
8 5V

HI, a circuit diagram of your project would help a lot.
A CAD drawing or a picture of a hand drawn circuit in jpg, png or pdf format is fine.

Tom… :slight_smile:

You might give some information about the motor and how the motor power is connected as well.

what is the problem actually, is there any problem in my connection and should i connect any external power supply to pin number 8 instead of 5V from Arduino for PWM
[/quote]

I've been using the L293D a lot recently and I suggest you connect PIN8 to an external source (not the arduino). Remember that connecting a motor direclty to arduino is a very good way to fry it!

what is the problem actually, is there any problem in my connection and should i connect any external power supply to pin number 8 instead of 5V from Arduino for PWM

You should swap arduino pins 10 and 11 so L293-Pin-1 goes to arduino pin 10.
and L293-Pin-2 => arduino d11
Also, connect leds to pins 9,10 and 11 of arduino with 220 ohm resistors so you can see the signal states.
Your biggest mistakes is that L293 PIN-8 IS MOTOR POWER NOT LOGIC POWER !!!
PIN -16 OF L293 IS LOGIC POWER !
DIDN’T YOU EVEN LOOK AT THE DATASHEET ?

l293d.pdf (372 KB)