Hello
I am having trouble getting two motors run how I want them to using an L293D motor driver. I found and old CD motor cartridge and thought I could use it in a project, if I could make the two motors run as I desire. If you can see the picture The lower Motor-1 moves the carraige up and down. (I can make it do that). I'd like to make the carraige go up and pause while Motor-2 runs a few seconds. Then the carraige should go down again. Using this code, the carraige goes up, motor-2 spins, but but the carraige won't go down but tries to go higher.
Any help with this would be greatly appreciated.
type or paste code here
//Motors code. Motor one drives lower unit up, then motor two spins for a few seconds
//after which motor one returns down
int enable3 = 3;
int enable9 = 9;
int In1 = 5;
int In2 = 10;
int In3 = 6;
int In4 = 11;
void setup(){
pinMode(enable3, OUTPUT);
pinMode(enable9, OUTPUT);
pinMode(In1, OUTPUT);
pinMode(In2, OUTPUT);
pinMode(In3, OUTPUT);
pinMode(In4, OUTPUT);
}
void loop(){
//----------------------------------motor 1 engaged, climbing!
analogWrite(enable3, 150); // Speed(0 to 255)
digitalWrite(In1, HIGH); //Motor moves carraige up
digitalWrite(In2, LOW);
delay(1400);
digitalWrite(In1, LOW); //Carraige stops
digitalWrite(In2, LOW);
delay(7000); //pause 1 secon
//------------------------------------motor 1 off
//------------------------------------motor 2 engaged, spinning.
analogWrite(enable9, 255);
analogWrite(In3, HIGH);
delay (3000);
digitalWrite(In3, LOW);
delay(1500);
//------------------------------------motor 2 off
//------------------------------------Motor 1 Engaged in reverse, descending.
analogWrite(enable3, 150);
digitalWrite(In1, LOW);
digitalWrite(In2, HIGH);
delay(1350);
digitalWrite(In1, LOW);
digitalWrite(In2, LOW);
delay(4000);
type or paste code here
}