Push button RESET VALUE

I have installed a flow meter to calculate liquid flow in a system. I get the total flow printed to an LCD screen. I am trying to add a button to reset the value to "0" when pressed, to start the flow calculation over.

I need help!!!

lcd.setCursor(0, 3);
 lcd.print("Flow:");
 lcd.setCursor(11, 3);
 lcd.print(Meter.getTotalVolume()); <----------- This is what I want to reset with the button
 lcd.print(" ");
 lcd.setCursor(16, 3);
 lcd.print("/OPM");

Work through and develop an understanding of the first five demos in IDE -> file/examples/digital. One or more of these are applicable to almost any Arduino project.

A guide to connecting the switch:

Putting your code in code tags pleases people - How to use this forum.

The function returns the protected variable _totalVolume. Unless you add a method to the class to zero that out, you're going to have to do something a little different.

For example:

const byte pinZeroVolume = 2;   //or whatever pin you want

double
    zeroFlowVolume;

byte
    lastSw;
    
void setup() 
{
    //set up a pin to be the zero button input
    pinMode( pinZeroVolume, INPUT_PULLUP );
    //and read it's current state for state-change checks
    lastSw = digitalRead( pinZeroVolume );
    .
    .
    .
    //set the zero flow volume to 0.0 to start
    zeroFlowVolume = 0.0f;
    .
    .
    .
}

void loop() 
{
    byte
        swNow;

    //read total volume reset switch
    swNow = digitalRead( pinZeroVolume );
    if( swNow != swLast )
    {
        //if not the same as last read...
        swLast = swNow;
        if( swNow == LOW )
        {
            //...and switch is low (pressed), set the
            //zeroFlowVolume variable to the current
            //flow volume
            zeroFlowVolume = Meter.getTotalVolume();
            
        }//if
        
    }//if

    .
    .
    .

    lcd.setCursor(0, 3);
    lcd.print("Flow:");
    lcd.setCursor(11, 3);
    //when printing the flow volume, print the
    //difference between the reported total and
    //the zero value set when the button was pressed
    lcd.print( Meter.getTotalVolume() - zeroFlowVolume );
    lcd.print(" ");
    lcd.setCursor(16, 3);
    lcd.print("/OPM");    

    .
    .
    .
    
}//loop

I think I have it figured out... It's working so for... PIN 8 is my push button. It resets my flow value and starts calculating flow.

  lcd.setCursor(0, 3);
  lcd.print("Flow:");
  lcd.setCursor(11, 3);
  lcd.print(Meter.getTotalVolume());
  lcd.print(" ");
  lcd.setCursor(16, 3);
  lcd.print("/OPM");
  
  if(digitalRead(8) == LOW)
  {
       lcd.setCursor(11,3);
   lcd.print("RESET");
   delay(1000);
   Meter = 0;
  }