Friday, April 26, 2019

Automatic watering system for plants using arduino

Automatic watering system for plants                 using arduino




Circuit Diagram


Code For uno



int digitalSensor = 2;
int pumpPin = 8; //relay pin

void setup() {
  pinMode(digitalSensor, INPUT);
  pinMode(pumpPin, OUTPUT);
}

void loop() {
  if(digitalRead(digitalSensor) == HIGH){
    digitalWrite(pumpPin, LOW);
    delay(1000);
  }
  else{
    digitalWrite(pumpPin, HIGH);
  }
  delay(100); // 1hour
}