Trying to drive servos with L293 H-bridge

Hi, so for a project I'm trying to drive two HS-322HD servos using a L293 H-bridge.

I have an Arduino to power the chip with 5V, and am using another 5V power supply to power the motors through the H-bridge. My servos (broken, so they can spin continuously) are barely turning; if they turn at all.

I was wondering if there is a voltage drop or something on the H-bridge that is causing the servos to not get enough power?

Thanks in advance.

My code (if needed):

#define trigPin 13
#define motor1Pin1 4
#define motor1Pin2 3
#define motor2Pin1 6
#define motor2Pin2 5
#define enablePin 9
#define echoPin 12
#define button 7
#define ledPin 8

long duration, distance, light, average1=0, average2=0, average3=0;
double buttonState, Value1, Value2, Value3, Value4, Value5;
int JohnDon=0;

void setup()

{ Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(A4, INPUT);
pinMode(7, INPUT);
pinMode(ledPin, OUTPUT);

}

void loop()
{ 
 
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

digitalWrite(ledPin, LOW);

buttonState = digitalRead(button);

int ldrStatus=analogRead(A4);

if (JohnDon==0){     //This part is for calibration
  
while (buttonState == LOW) {
  buttonState = digitalRead(button);
}

    digitalWrite(ledPin, HIGH);
    delay(3000);
    Value1 = analogRead(A4);
    delay(5);
    Value2 = analogRead(A4);
    delay(5);
    Value3 = analogRead(A4);
    delay(5);
    Value4 = analogRead(A4);
    delay(5);
    Value5 = analogRead(A4);
    digitalWrite(ledPin, LOW);
    average1 = (Value1+Value2+Value3+Value4+Value5)/5;
    delay(1000);
  
    digitalWrite(ledPin, HIGH);
    delay(3000);
    Value1 = analogRead(A4);
    delay(5);
    Value2 = analogRead(A4);
    delay(5);
    Value3 = analogRead(A4);
    delay(5);
    Value4 = analogRead(A4);
    delay(5);
    Value5 = analogRead(A4);
    digitalWrite(ledPin, LOW);
    average2 = (Value1+Value2+Value3+Value4+Value5)/5;

    average3 = (average1 + average2)/2;
    delay(1000);

    JohnDon=1;
}
  

if (ldrStatus <= average3){
  digitalWrite(motor1Pin1, LOW);
  digitalWrite(motor2Pin1, LOW);
  digitalWrite(motor1Pin2, LOW);
  digitalWrite(motor2Pin2, LOW);
}
else{

duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;

digitalWrite(enablePin, HIGH);
 
if (distance < 20)

{ digitalWrite(motor1Pin1, HIGH);
  digitalWrite(motor2Pin1, HIGH);
  digitalWrite(motor1Pin2, LOW);
  digitalWrite(motor2Pin2, LOW);
  Serial.print("Wheels: Reverse ");
}

else if (distance > 25) {

digitalWrite(motor1Pin1, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin2, HIGH);
Serial.print("Wheels: Forward ");
}

else{

digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
Serial.print("Wheels: Stopped ");
}

delay(500);
}
}

From the data sheet the servo should do about 70rpm at 5v

Maybe try a much more basic sketch that simply turns on the servo motor and leaves it on and observe how fast the servos spin.

Your code has motor control looped with hard delay so that’s something to consider rewriting like the blink without delays examples.

Why not measure the voltage at the motors at 100%?

What makes this servo needs an H-bridge driver?

And that's a very old H-bridge, with huge losses: about 2V drop. Get a modern H-bridge, MOSFET based. Virtually no voltage drop (e.g. TB6621FNG dual H-bridge or DRV8838 single H-bridge). Similar current specs as the L293N but no heat sink in sight.

When using an ultrasonic rangefinder you should pulse the Trigger pin JUST BEFORE you look for a pulse on the Echo pin.