unlatch when moisture reachs a set value

Hi
i am pulling my hair out, whats left of it.
I have a problem with a program.
When a button1 is pressed outputA latches on, and unlatches when button2 is pressed, this works fine. I am also using a moisture sensor which writes to the serial monitor, this works fine also. my problem is, when the moisture reading reaches higher than say 200 i want outputA to unlatch also.

I am a ancient newbie so go easy.

JANS_REMOTE_MOISTURE_SENSOR.ino (2.23 KB)

Serial.println(readSoil()); ???

int readSoil() ????

void moisturesensorloopcode() 
{
  int MoistureValue=readSoil();
  Serial.print("Soil Moisture = ");
  Serial.println(MoistureValue);
  if(MoistureValue > 200)
    {
    digitalWrite (ledPin, LOW);
    }
  //This 1 second timeframe is used so you can test the sensor and see it change in real-time.
  //For in-plant applications, you will want to take readings much less frequently.
  delay(100);//take a reading every second
}

Thank you for the quick replies. I tried what you suggested wildbill and it worked great.

all the best.