Change conditioning in real time I am currently writing a program that reads an output voltage from a capacitive moisture sensor and depending on the moisture content, it will water some plants accordingly. I would like to make it so that a user can change the condition in real time because different plants will require different amounts of water. This will give a little more freedom on how much water the user would prefer for their plant. This is the code I have so far:

int solenoidPin = 4; //connected to Digital 4
int moisturePin = A0; //connected to Analog A0

void setup() {
  Serial.begin(9600);
  pinMode(solenoidPin, OUTPUT);
}
void loop() {
  int val;
  moisture = analogRead(moisturePin); //connect sensor to Analog A0
  Serial.println(val); //print the value to serial port
  delay(1000); //wait 1 second for next reading

  if (moisture &lt;= 350) //if moisture is less than reading 350 {
  digitalWrite(solenoidPin, HIGH); //switch solenoid ON
  delay(600000) //water for ten minutes
  digitalWrite(solenoidPin, LOW); //switch solenoid OFF
  }
  else {                     
  digitalWrite(solenoidPin, LOW); //switch solenoid OFF
  }                      
}


I am aware that there is a touch screen shield for the Arduino and I could possibly allow the user to interact what is going on. However, I'm just asking if it's possible to change the if (moisture &lt;= 350) while the code is running and perhaps allowing the user to change that value. If so, then how? Could I use a touch screen shield or another shield that allows a user to change the condition?
if (moisture &lt;= 350) //if moisture is less than reading 350 {



That is wrong, because you have the brace { after the comment. You need it before the comment, eg.

 if (moisture &lt;= 350) { //if moisture is less than reading 350


Or preferably in my opinion:

if (moisture &lt;= 350) //if moisture is less than reading 350
  {





  I'm just asking if it's possible to change the if (moisture &lt;= 350)


Yes, of course. That's what variables are for. You could read a potentiometer, and the value from that could replace 350 in the code. You could use a simple LCD or LED display to show what the current reading is.




  delay(600000) //water for ten minutes


Your problem here is that the sketch will be totally unresponsive (it would not react to your changing the moisture level) during the time you are watering. You might want to read How to do multiple things at once which shows how you can keep doing other things, while waiting for time to elapse.