Fire Detector Notification Program Code
























Program Code:-

//TECHNICAL SCIENTIST RM
//Fire Alarm Notification Using Blynk App
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = ""; //Auth code sent via Email
char ssid[] = ""; //Wifi name
char pass[] = "";  //Wifi Password
int flag=0;
void notifyOnFire()
{
  int isButtonPressed = digitalRead(D1);
  if (isButtonPressed==1 && flag==0) {
    Serial.println("Fire in the House");
    Blynk.notify("Alert : Fire in the House");
    flag=1;
  }
  else if (isButtonPressed==0)
  {
    flag=0;
  }
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(D1,INPUT_PULLUP);
timer.setInterval(1000L,notifyOnFire); 
}
void loop()
{
  Blynk.run();
  timer.run();
}

Comments

  1. Bhai code is working right ??

    ReplyDelete
  2. what libraries should i install to get this code working
    ?

    ReplyDelete

Post a Comment