#define AOUT_PIN A0 // Arduino pin that connects to AOUT pin of moisture sensor
void setup() {
Serial.begin(9600);
}
void loop() {
int value = analogRead(AOUT_PIN); // read the analog value from sensor
Serial.print("Moisture: ");
Serial.println(value);
delay(500);
}
Determina se il terreno è umido o asciutto
#define AOUT_PIN A5 // Arduino pin that connects to AOUT pin of moisture sensor
#define THRESHOLD 100 // 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);
}