Hey guys, so recently ive been working on my rc car and i just hooked up the circuit for the rear 12v dc motor. Im using an L293d h bridge to control the speed and direction and used this site http://itp.nyu.edu/physcomp/Labs/DCMotorControl for the circuit diagrams. I tested it out and it worked twice running the same code. Then I went to sleep and woke up the next day seeing that it is no longer working. I cant figure out what happened. Please help!!!
Heres the code:
const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A)
const int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A)
const int enablePin = 9; // H-bridge enable pin
void setup() {
// set all the other pins you're using as outputs:
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
// set enablePin high so that motor can turn on:
digitalWrite(enablePin, HIGH);
digitalWrite(enablePin,HIGH); //enable on
digitalWrite(motor1Pin,HIGH); //one way
digitalWrite(motor2Pin,LOW);
delay(1000);
digitalWrite(enablePin,LOW); //slow stop
delay(3000);
digitalWrite(enablePin,HIGH); //enable on
digitalWrite(motor1Pin,HIGH); //one way
digitalWrite(motor2Pin,LOW);
delay(1000);
digitalWrite(motor1Pin,LOW); //fast stop
delay(3000);
}
void loop() {
}
Here are some pics of the circuit. It may be a little tough to match cause of the wire mess. Sorry about that
thanks for the help!
P.S
Positive lead for battery is green, negative is white. sorry for the confusion with all the colors. Also, theres a green jumper at the end of the breadboard that is connected to ground on the arduino, it just doesnt show the other end. AND, Im using a 9v battery. Do you think i broke the h-bridge? I know that the motor itself is perfectly fine because i plugged it in directly to a 9v battery and it worked.