Автополив растений
скетч
int soilMoistureValue = 0;
int percentage=0;
void setup() {
pinMode(3,OUTPUT);
(9600);
}
void loop() {
soilMoistureValue = analogRead(A0);
(percentage);
percentage = map(soilMoistureValue, 490, 1023, 100, 0);
if(percentage < 10)
{
(“ pump on“);
digitalWrite(3,HIGH);
}
if(percentage >80)
{
(“pump off“);
digitalWrite(3,LOW);
}
}