#define AOUT_PIN 36 // ESP32 pin GIOP36 (ADC0) that connects to AOUT pin of moisture sensor
#define THRESHOLD 1000 // CHANGE YOUR THRESHOLD HERE
void setup()
{
Serial.begin(9600);
}
void loop()
{
int value = analogRead(AOUT_PIN); // read the analog value from sensor
if (value < THRESHOLD)
Serial.print("The soil is DRY (");
else
Serial.print("The soil is WET (");
Serial.print(value);
Serial.println(")");
delay(500);
}