//define analog inputs to which we have connected our sensors int moistureSensor = A7; //define variables to store moisture value int moisture_val; void setup() { //open serial port Serial.begin(9600); //set the water are turned off pinMode (P1_4, OUTPUT); digitalWrite (P1_4, LOW); } void loop() { // read the value from the moisture-sensing probes, print it to screen, and wait a second moisture_val = analogRead(moistureSensor); //turn water on when soil is dry, and delay until soil is wet if (moisture_val <600) { digitalWrite(P1_4, HIGH); } else { moisture_val = analogRead(moistureSensor); delay(1000); digitalWrite(P1_4, LOW); } Serial.print("moisture sensor reads "); Serial.println(moisture_val); delay(1000); delay(1000); }