Automatic plant watering system

 Automatic plant watering system















code



#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Hd1hZ4_5fSBJGet3UiE2YtwZRoql9tLT";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Aish";
char pass[] = "1234567788";

#define WATER_PUMP D3
boolean state = false;

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  pinMode(WATER_PUMP, OUTPUT);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void loop()
{
  Blynk.run();
}
BLYNK_WRITE(V1)
{
  if (state == false) {
    state = true;
    Blynk.notify("You just watered your plant.");
    digitalWrite(WATER_PUMP,HIGH);
    delay(1000);
  }
  else {
    state = false;
    digitalWrite(WATER_PUMP,LOW);
  }
}

Post a Comment

My Instagram

Made with by Pi-girl | Copyright © 2020 Pi-girl