Problem with tare function when using load cell with ultrasound and dc motor

Hello! So I am currently working on a project to combine a load cell, ultrasound sensor and a peristaltic pump to dispense some water until the glass reaches a certain weight. Individually, all three components are working fine and I have been able to integrate the ultrasound sensor and the pump without any problems however, when I try to integrate all 3, I seem to face a problem. The tare function in my void setup is somehow not executing and as a consequence, the serial monitor is stuck at the code before the tare function. I am wondering if this is a programming error and if so, why is it not working?

//author of ultrasound code: www.elegoo.com
//author of load code: Nathan Seidle

#include "SR04.h"
#define TRIG_PIN 12
#define ECHO_PIN 11
#include "HX711.h"
#define RST 4
#define DOUT  3
#define CLK  2
HX711 scale(DOUT, CLK);
float calibration_factor = -2680.00; //-7050 worked for my 440lb max scale setup
float oldCal_factor;
float oldWeight;
SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN);
long petriDish;
int pushButton = 2;
int motorControl = 9;
void setup() {
  Serial.begin(9600);
  Serial.println("test line");// wrote these testlines to see which part of my setup is holding up the program
  pinMode(pushButton, INPUT);  
  pinMode(motorControl, OUTPUT);
  Serial.println("HX711 calibration sketch");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale");
    scale.set_scale();
    scale.tare();  //Reset the scale to 0
   //Get a baseline reading
    long zero_factor = scale.read_average();
    
    //This can be used to remove the need to tare the scale.
    // Useful in permanent scale projects.
  
    Serial.print("Zero factor: ");
    Serial.println(zero_factor);
    // Reset pin (to rezero the weight not reset the board!)
    pinMode(RST, INPUT_PULLUP);
     delay(1000);
  
}

void loop() {
   scale.set_scale(calibration_factor);
  // Read an average of X readings
  float weight = scale.get_units(10);

  // An intermediate weigth value that we round according to some rules
  int netWeight = 0 ;

  // Make scale more sensitive at lower end
  // Weight > X then just round to nearest integer

  if (weight >= 5.0) {
    netWeight = (weight * 10.0);
    weight = (int)(0.5 + (netWeight / 10.0));
  }

  // Weight < Y then call it zero

  else if (weight > -0.01 && weight <= 0.01) {
    
    weight = 0;

  }

  // Any other weight will have 1 dec. place of precision

  else {

    netWeight = (weight * 10.0);
    weight = (netWeight / 10.0);

  }
  // Only print something out if it has changed (weight or cal. factor)

  if (calibration_factor != oldCal_factor || weight != oldWeight) {
    oldCal_factor = calibration_factor;
    oldWeight = weight;
    Serial.print("Reading: ");
    Serial.print(weight, 2);
    Serial.print(" g");
    Serial.print(" calibration_factor: ");
    Serial.print(calibration_factor);
    Serial.println();

  }

   petriDish=sr04.Distance();
   Serial.print(petriDish);
   Serial.println("cm");
   if ( petriDish <= 10){
      do {
      digitalWrite(motorControl, HIGH); 
      Serial.println("motoring"); 
      }  while( weight <=30);
   }
   digitalWrite(motorControl, LOW); 
   delay(100);
}

load cell working normal.JPG

OP's Images:
load cell working normal.JPG

I am wondering if this is a programming error and if so, why is it not working?

I'd suspect a pin conflict somewhere. Try moving your PING sensor to other pins.

   petriDish=sr04.Distance();

That makes no sense. I can see NOTHING that suggests, later on, that petriDish contains a distance.

      do {
      digitalWrite(motorControl, HIGH);
      Serial.println("motoring");
      }  while( weight <=30);

NOTHING in the body of the while loop changes the value of weight, so, once the do/while statement starts, it will NEVER end.

There is NO reason to turn the pin on over and over and over and over.