Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Watch now!Tune in to Hackster Holidays, Ep. 4 now!
Techatronic
Published

Blynk Fire Alarm

This is a fire alarm system that we make using nodemcu and flame sensor.

BeginnerFull instructions provided2 hours1,479
Blynk Fire Alarm

Things used in this project

Story

Read more

Code

Code snippet #1

Plain text
 
 void notifyOnFire()  
 {  
  int isButtonPressed = digitalRead(D1);  
  if (isButtonPressed==1 && flag==0) {  
   Serial.println("Fire DETECTED");  
   Blynk.notify("Alert : Fire detected");  
   flag=1;  
  }  
  else if (isButtonPressed==0)  
  {  
   flag=0;  
  }  
 }

Code snippet #2

Plain text
 
 void notifyOnFire()  
 {  
  int isButtonPressed = digitalRead(D1);  
  if (isButtonPressed==1 && flag==0) {  
   Serial.println("Fire DETECTED");  
   Blynk.notify("Alert : Fire detected");  
   flag=1;  
  }  
  else if (isButtonPressed==0)  
  {  
   flag=0;  
  }  
 }

Code snippet #3

Plain text
  
 void setup()  
 {  
 Serial.begin(9600);  
 Blynk.begin(auth, ssid, pass);  
 pinMode(D1,INPUT_PULLUP);  
 timer.setInterval(1000L,notifyOnFire);   
 }  
 void loop()  
 {  
  Blynk.run();  
  timer.run();  
 }  

Code snippet #4

Plain text
  
 void setup()  
 {  
 Serial.begin(9600);  
 Blynk.begin(auth, ssid, pass);  
 pinMode(D1,INPUT_PULLUP);  
 timer.setInterval(1000L,notifyOnFire);   
 }  
 void loop()  
 {  
  Blynk.run();  
  timer.run();  
 }  

Code snippet #5

Plain text
 //TECHATRONIC.COM  
 // BLYNK LIBRARY  
 // https://github.com/blynkkk/blynk-library  
 // ESP8266 LIBRARY  
 // https://github.com/ekstrand/ESP8266wifi  
 #define BLYNK_PRINT Serial  
 #include <ESP8266WiFi.h>  
 #include <BlynkSimpleEsp8266.h>  
 BlynkTimer timer;  
 char auth[] = "your-auth-code"; //Auth code sent via Email  
 char ssid[] = "your-wifi-ssid"; //Wifi name  
 char pass[] = "your-wifi-password"; //Wifi Password  
 int flag=0;  
 void notifyOnFire()  
 {  
  int isButtonPressed = digitalRead(D1);  
  if (isButtonPressed==1 && flag==0) {  
   Serial.println("Fire DETECTED");  
   Blynk.notify("Alert : Fire detected");  
   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();  
 }  

Code snippet #6

Plain text
 //TECHATRONIC.COM  
 // BLYNK LIBRARY  
 // https://github.com/blynkkk/blynk-library  
 // ESP8266 LIBRARY  
 // https://github.com/ekstrand/ESP8266wifi  
 #define BLYNK_PRINT Serial  
 #include <ESP8266WiFi.h>  
 #include <BlynkSimpleEsp8266.h>  
 BlynkTimer timer;  
 char auth[] = "your-auth-code"; //Auth code sent via Email  
 char ssid[] = "your-wifi-ssid"; //Wifi name  
 char pass[] = "your-wifi-password"; //Wifi Password  
 int flag=0;  
 void notifyOnFire()  
 {  
  int isButtonPressed = digitalRead(D1);  
  if (isButtonPressed==1 && flag==0) {  
   Serial.println("Fire DETECTED");  
   Blynk.notify("Alert : Fire detected");  
   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();  
 }  

Credits

Techatronic

Techatronic

72 projects • 127 followers
Electronic engineer

Comments