#define BLYNK_TEMPLATE_ID "TMPL3c-tdVjGY"
#define BLYNK_TEMPLATE_NAME "Fire notification"
#define BLYNK_AUTH_TOKEN "F4a6jNL19DPgycoBHpFIG3vjTxB-Qm62"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Aslam"; // type your wifi name
char pass[] = "123456789"; // type your wifi password
BlynkTimer timer;
int photopin = A0;
int value;
void sendSensor() {
value = analogRead(photopin);
if (value < 200) {
Serial.println("FIRE DETECTED!");
Blynk.email("[email protected]", "Alert", "Fire Detected!");
Blynk.logEvent("fire_detected", "Fire Detected");
}
else
{
Serial.println("No Fire");
}
}
void setup() {
pinMode(A0, INPUT);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
//dht.begin();
timer.setInterval(5000L, sendSensor);
}
void loop() {
Blynk.run();
timer.run();
}