#define SOIL_MOISTURE_PIN 34 // Analog pin connected to the soil moisture sensor
void setup() {
Serial.begin(115200);
}
void loop() {
int soilMoistureValue = analogRead(SOIL_MOISTURE_PIN);
Serial.print("Soil Moisture Value: ");
Serial.println(soilMoistureValue);
// Simulate soil moisture level
if (soilMoistureValue < 1000) {
Serial.println("Soil is dry!");
} else if (soilMoistureValue < 2000) {
Serial.println("Soil is moist.");
} else {
Serial.println("Soil is wet!");
}
delay(2000); // Wait a few seconds between measurements
}