Capacitive Soil Moisture Sensor
Добавлено: Вт ноя 20, 2018 8:47 am
добавьте единственный долго работающий датчик влажности почвы Capacitive Soil Moisture Sensor
выдает данные
Dry: (520 430]
Wet: (430 350]
Water: (350 260]
Код: Выделить всё
/***************************************************
This example reads Capacitive Soil Moisture Sensor.
****************************************************/
const int AirValue = 520; //you need to replace this value with Value_1
const int WaterValue = 260; //you need to replace this value with Value_2
int intervals = (AirValue - WaterValue)/3;
int soilMoistureValue = 0;
void setup() {
Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
}
void loop() {
soilMoistureValue = analogRead(A0); //put Sensor insert into soil
if(soilMoistureValue > WaterValue && soilMoistureValue < (WaterValue + intervals))
{
Serial.println("Very Wet");
}
else if(soilMoistureValue > (WaterValue + intervals) && soilMoistureValue < (AirValue - intervals))
{
Serial.println("Wet");
}
else if(soilMoistureValue (AirValue - intervals))
{
Serial.println("Dry");
}
delay(100);
}
Dry: (520 430]
Wet: (430 350]
Water: (350 260]