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);
}