Hey Guys!
I am new to Arduino Programming. I am on a project of a self watering plant. What it does is that when the moisture level is low the water pump(3-6v) supplies water to the plant until the moisture level is high enough. So i developed this code but i am not sure with the programming. I would really appreciate if you guys would be kind enough to correct my mistakes and update it.
This is the code:
int thresholdUp = 600;
int thresholdDown = 450;
int mostureSensor = A0;
int Water_Pump = A3;
int sensorValue = moistureSensor;
void setup() {
pinMode(Water_Pump, OUTPUT);
void loop() {
int sensorValue = analogRead(moistureSensor);
Serial.println(moistureSensor);
if (sensorValue > 800 && sensorValue < 1500)
{
digitalWrite(Water_Pump, HIGH);
else (sensorValue >300 && sensorValue < 600)
{
delay(2000);
digitalWrite(Water_Pump, LOW);
}
}
}
Do suggest me about the threshold values too.