Plant π³ Water Notification Using NodeMCU || Soil Moisture Sensor || Blynk App
Program Code :- // Technical Scientist RM //www.youtube.com/c/TechnicalScientistRM #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> char auth[] = "Auth Code"; //code sent via email const int sensorPin = 4; int sensorState = 0; int lastState = 0; void setup() { Serial.begin(9600); Blynk.begin(auth, "WiFi Name", "Password"); //wifi name and password pinMode(sensorPin, INPUT); } void loop() { Blynk.run(); sensorState = digitalRead(sensorPin); Serial.println(sensorState); if (sensorState == 1 && lastState == 0) { Serial.println("needs water, send notification"); Blynk.notify("Time To Water The Plants"); lastState = 1; delay(1000); //send notification } else if (sensorState == 1 && lastState == 1) { //do nothing, has not been watered yet ...






