Need to insert button code into project

Hi I have written some code to run a liquid fill.

I am filling by weight using a hx711 scale to open and close a relay.
So far so good,everything is calibrated and working and I am able to tare an empty bottle and fill to set weight with the relay turning off as it should.

When I remove the bottle the relay opens straight away,this is what I am trying to stop.

What I have spent hours on and failed to do is insert a button that on pressing opens the relay after placing an empty bottle on the scale and using tare to zero weight.

The relay closes after the set weight is reached so I only need a button to open/start the relay.
I am new to arduino and think i have done ok so far,I only ask for help after spending to many hours on the button side of the project.
Any help would be really appreciated and save me having to use fiver ect and paying for a soulution.
My code without a button:

#include <HX711.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x3F, 16, 2); // set the LCD address to 0x20 for a 16 chars and 2 line display


int tare = 10;
int relay = 11;


int grams; //varible for grams on lcd screen
int lagtime; //varible for delay on lcd screen


#define DOUT  2
#define CLK  3

HX711 scale(DOUT, CLK);



void setup() {
  pinMode(tare, INPUT);
  pinMode(relay, OUTPUT);


  digitalWrite(relay, HIGH);// keep the load OFF at the begining. If you wanted to be ON, change the HIGH to LOW

 //  Switch on the backlight
  lcd.init();                      // initialize the lcd
  lcd.backlight();
  lcd.setCursor(0, 1);
  delay(100);

  lagtime = constrain(lagtime, 1, 10);


  scale.set_scale(2104.50);                      // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();               // reset the scale to 0



}

void loop() {

    float current = (scale.get_units(), 2);


  if
  (digitalRead (tare) == HIGH)// if we detect a 1 on the other switch pin
  {
    scale.tare();// zero grams to tare weight

  }

 
  lcd.setCursor (0, 0); // set the cursor to 0,0
  lcd.print ("set"); // Print set to and your ideal grams
  lcd.print (grams + 551.00);





  lcd.setCursor(0, 1);
  lcd.print(scale.get_units(),0 );
  

if (scale.get_units() < -550) // not sure i will need this when a button is added
{
digitalWrite (11,HIGH);// not sure i will need this when a button is added

  }

  if (scale.get_units() > -551)
  {
       digitalWrite(11, LOW);
       
      }

}

// we're done

What's the issue? You know how to set up and read an input - you're doing it with your tare button. Do the same thing with your new 'start' button and when it's pressed, set the relay to fill.

I tried that,the problem I had was I was asking the button to open the relay and it did.
The set weight was turning off the relay ok but the button was keeping the relay open as i was asking the same pin (relay) to close on weight set but stay open from the button.

Post the code you tried with the button

The problem I now have is when the weight is reached the relay is bouncing.

#include <HX711.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x3F, 16, 2); // set the LCD address to 0x20 for a 16 chars and 2 line display

int pbuttonPin = 9; // relay start stop button
int tare = 10;
int relay = 11;


int grams; //varible for grams on lcd screen
int lagtime; //varible for delay on lcd screen

#define DOUT  2
#define CLK  3

HX711 scale(DOUT, CLK);
int val = 0; // push value from pin 9
int lightON = 0;//light status
int pushed = 0;//push status


void setup() {
  //Serial.begin(9600);
  pinMode(tare, INPUT);
  pinMode(relay, OUTPUT);
  pinMode(pbuttonPin, INPUT_PULLUP);//pinMode(pbuttonPin, INPUT); // relay start stop button
  digitalWrite(relay, HIGH);// keep the load OFF at the begining. If you wanted to be ON, change the HIGH to LOW

 //  Switch on the backlight
  lcd.init();                      // initialize the lcd
  lcd.backlight();
  lcd.setCursor(0, 1);
  delay(100);




  lagtime = constrain(lagtime, 1, 10);




  scale.set_scale(2104.50);                      // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();               // reset the scale to 0



}

void loop() {
  val = digitalRead(pbuttonPin);// read the push button value

  if(val == HIGH && lightON == LOW){
  

    pushed = 1 - pushed;
    delay(100);
  }

  lightON = val;

  if (pushed == HIGH) {
   // Serial.println("Light ON");
    digitalWrite(relay, LOW);
  }
  else {
   // Serial.println("Light OFF");
    digitalWrite(relay, HIGH);

  }

  delay(100);
  {

    float current = (scale.get_units(), 2);


  }



  if
  (digitalRead (tare) == HIGH)// if we detect a 1 on the other switch pin
  {
    scale.tare();// zero grams to tare weight

  }


  lcd.setCursor (0, 0); // set the cursor to 0,0
  lcd.print ("grams"); // Print set to and your ideal grams
  lcd.print (grams + 551.00);





  lcd.setCursor(0, 1);
  lcd.print(scale.get_units(), 2);



 // if (scale.get_units() < -400) // if the scale weight exceeds set weight.
  {
  //  digitalWrite (relay, HIGH); // Close the valve

  }
  if (scale.get_units() > -550) // if the scale weight exceeds set weight.
  {
    digitalWrite (relay, HIGH);
  }

}
// we're done