i set it up with an 9v Block battery or 6v (4x 1xAAA) but the motor wont move...
here's the code:
int motor1_A=11;
int motor1_B=10;
int motor1_Speed=9;
int motor2_A=6;
int motor2_B=5;
int motor2_Speed=3;
int led_lm = 16;
int led_rm = 17;
int led_red = 15;
int led_green = 14;
void setup(){
pinMode(motor1_A,OUTPUT);
pinMode(motor1_B,OUTPUT);
pinMode(motor2_A,OUTPUT);
pinMode(motor2_B,OUTPUT);
pinMode(led_lm,OUTPUT);
pinMode(led_rm,OUTPUT);
pinMode(led_red,OUTPUT);
pinMode(led_green,OUTPUT);
digitalWrite(led_red,HIGH);
}
void loop(){
//digitalWrite(led_red,LOW);
//digitalWrite(led_green,HIGH);
// motor1
//digitalWrite(led_lm,HIGH);
//digitalWrite(led_rm,LOW);
for (int i=0; i<256; i+=5){
digitalWrite(motor1_A,HIGH); // A = HIGH and B = LOW means the motor will turn right
digitalWrite(motor1_B,LOW);
analogWrite(motor1_Speed,i); // speed counts from 0 to 255
delay(20);
}
for (int i=255; i<0; i-=5){
digitalWrite(motor1_A,HIGH); // A = HIGH and B = LOW means the motor will turn right
digitalWrite(motor1_B,LOW);
analogWrite(motor1_Speed,i); // speed counts from 0 to 255
delay(20);
}
}
9V block batteries are for smoke alarms and are useless for motors.
The L293D has limited current capabilities and is not suitable for most motors. What is the stall current of your motor (equivalently, what is the winding resistance)?
about the motors... i bought them used from a flea market so about stall current or something.. theres no writing on it... is there a way how i can test this?
to be honest, i'm still new to this, and stall current or winding resistance with motors are new for me ^^'
Do the motors run if you connect them straight to the batt terminals? Can you post a wiring diagram? Pics are good but it's hard to tell what's hooked to what with wires running out of the picture and obscuring other connections.
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
A hand drawn circuit will be good, if you draw your circuit from your project, it will ensure you have wired it correctly.
Please label all pins and connections and include power supplies.
I know this sounds silly, but you will learn a lot from drawing your own diagram and may find your problem.
If you use REPLY rather then QUICK REPLY you will find there is an ATTACHMENT facility.
Pictures of protoboards are good, but do not include any text about PCB connections.
Please attach all your images, cloud is not good if you are using a handheld/pad device to view the forum.