You are on page 1of 1

void setup()

{
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(3,OUTPUT);
}

void loop()
{
int SensorValue = analogRead(A0); //take a sample
Serial.print(SensorValue); Serial.print(" - ");

if(SensorValue >= 600) {


Serial.println("Sensor is not in the Soil or DISCONNECTED");
digitalWrite(3,HIGH);
}

else
{

Serial.println("Soil is HUMID");
digitalWrite(3,LOW);
}

delay(50);
}

You might also like