Pushbutton function in my (water irrigation system.)

I working on water irrigation system.

I need help with and get a function

I will have the opportunity too push a button. So systeam is ignore the clock

 if((H == 15) && (M == 42) && (S == 01)){
    while(moistureSensorValue >= 700){

and water the plent if it dry.

Here is the code snip:

// if the soil is dry and if it is the right time: turn on the pump for 1 minute
  if((H == 15) && (M == 42) && (S == 01)){
    while(moistureSensorValue >= 700){
      //hvis det er tørrt og klokka er 3.42.01 så kjøres den her
      // system messages
   //   lcd.clear();
      lcd.setCursor(0,1);
      RightHour();
      lcd.setCursor(0,2);
      lcd.print(string_table[8]);
      lcd.setCursor(0,3);
      lcd.print(string_table[5]);
     lcd.setCursor(0,2);
     lcd.write((uint8_t)5);
      // turn the pump on
      digitalWrite(pumpPin,HIGH);
      digitalWrite(pumpLEDPin,HIGH);
      delay(10000);
      // if the soil is not moist so far
      // reads the moisture sensor once more
      moistureSensorValue = analogRead(moistureSensorPin);
    }
    // turn the pump off
    digitalWrite(pumpPin,LOW);
    digitalWrite(pumpLEDPin,LOW);
  }

You need too look on the full code?

I will have the opportunity too push a button. So systeam is ignore the clock

So, you want something like:

  if((H == 15) && (M == 42) && (S == 01))
   {
      // water the plant until it is wet enough
   }
   else if(digitalRead(somePin) == HIGH) // Or LOW, depending on how the switch is wired
   {
      // Start the watering
      while(digitalRead(somePin) == HIGH) // Or LOW...
      {
         // do nothing until the override switch is released
      }
      // Stop watering
   }

Yes but i need too check moistureSensor too:)

if((H == 15) && (M == 42) && (S == 01)){
    while(moistureSensorValue >= 700){

Yes but i need too check moistureSensor too:)

So, do that. It is exactly the same for the override switch case as for the time case. If the override switch is just supposed to water until the soil is most enough, remove the while loop. That is there to keep watering for the whole time the switch is pressed, stopping as soon as it is released.