Hi Pete / Experts,
I am working on a water irrigation project.
the concept is simple as below.
I will get a notification from my Blynk app based on the Soil Moisture status.
Based on that status, I will water the plant by pressing the button from Blynk.
- ESP8266
- Soild Moisture sensor
-Relay
-Pump
Issue:-
the issue I am facing with the “Delay”
I want to get a notification when the sensor value changes every 15 minutes
(900000). The problem is, my esp8266 also getting disconnect from the internet every 15 minutes
Below is my 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[] = "MyCode"; //code sent via email
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "mywifi";
char pass[] = "Mypassword";
int sensorPin = 5; // Input pin for the Flame Sensor
int sensorValue = 0; // Variable to store the value coming from the flame sensor
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(5, INPUT);
}
void loop()
{
Blynk.run();
sensorValue = digitalRead(sensorPin);
if (sensorValue == 1) {
Blynk.notify("Water your plant");
}
delay(900000); //15 minutes
}
I am not sure where I should be adding the delay syntax
Appreciate your advice, thank you.
Regards
KM