Hello
When I receive a notification from the sensor, I want the next notification to come when the value in the sensor changes. If the notification came at 25 C, I want the next notification to come at 26 C. Can you help me?
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
// Your WiFi credentials.
// Set password to "" for open networks.
char auth[] = "";
char ssid[] = "";
char pass[] = "";
#define DHTPIN 4 // What digital pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
float nem = dht.readHumidity();
float sicaklik = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(nem) || isnan(sicaklik)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V1, nem);
Blynk.virtualWrite(V0, sicaklik);
}
void sendAlert()
{
float nem = dht.readHumidity();
float sicaklik = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if(sicaklik > 26)
{
Blynk.notify(String("Sıcaklık Yüksek ")+sicaklik + String("°C"));
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V0, sicaklik);
}
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
dht.begin();
// Setup a function to be called every second
timer.setInterval(5000L, sendSensor);
timer.setInterval(60000L, sendAlert);
}
void loop()
{
Blynk.run();
timer.run();
}