L293d motor controller problems

L293d motor controller problems. I am trying to build a circuit using the L293d h-bridge. I need bidirectional control of two small dc motors. I have tried circuit after circuit from the internet, and the best I have done is to get control in one direction only. Most of the circuit and programs I have tried had problems. My final goal is to use an arduino nano with my homebuilt L293 chip. I was originally trying to get it to work with a Uno, but for some reason the serial com port kept changing and dropping out, which is another matter. Right now Im trying to get it to work with a mega. But for some reason, any of the programs. The below code seems to only respond to: digitalWrite(motor1Pin1, LOW); // set pin 2 on L293D low

digitalWrite(motor1Pin2, HIGH); // set pin 7 on L293D high

I can’t get the motors to reverse!

Does anyone have or know of a TESTED circuit diagram AND corresponding program that works, forward, and reverse.

I have spent many hours trying to get this to work. Please don’t suggest a bought motor shield, as I am working with students, and each student needs to pay for parts, and we need to keep the cost as low as possible,

Thanks for ANY help!

one of the programs include:

void loop() {

// if the switch is high, motor will turn on one direction:

if (digitalRead(switchPin) == HIGH) {

digitalWrite(motor1Pin1, LOW); // set pin 2 on L293D low

digitalWrite(motor1Pin2, HIGH); // set pin 7 on L293D high

}

// if the switch is low, motor will turn in the opposite direction:

else {

digitalWrite(motor1Pin1, HIGH); // set pin 2 on L293D high

digitalWrite(motor1Pin2, LOW); // set pin 7 on L293D low

}

}

Have you tried the app circuit in the data sheet and just use switches (setting logic lows and highs on the input pins) to test the L293’s basic functionality?

Instead of connecting motors just connect a load resistor (select for current and power disapation) and use a Voltmeter to test the L293’s outputs using switches for the inputs.

What are the motor you are using? Current draw? Link to data sheet?

Did you install to protection Diodes as per the data sheet?

Which internet circuits did you try?

Once this works properly with manual control then connect a processor.

With the processor, do you have a common connected between the L293 & processor?