//Succesfull last effort in modifing code 20.4.23 1:02AM mergecode by sanket. notification and app notice use blynk 1.1.0 library and ESP8266WiFi.h 1.0.6
// Blynk cloud server link [[email protected] ] https://blynk.cloud/dashboard/163065/global/filter/1036991/organization/163065/devices/641877/dashboard
//video 1 link https://youtu.be/T8vPXUrAfco
// code links https://github.com/itsbhupendrasingh/Fire-Detection-with-email-alert-new-Blynk2
//video 2 links https://www.youtube.com/watch?v=pRCcmMQ66jE&list=PLvDPwJ_P7XNakbYC7OlO6XuLf7nCIA55h&index=2
// code links https://github.com/Tech-Trends-Shameer/Blynk-2.0-Projects/tree/main/Fire-Alert-Notification-Using-ESP8266-and-Blynk-IOT
// Chage These Credentials with your Blynk Template credentials
// Chage These Credentials with your Blynk Template credentials
#define BLYNK_TEMPLATE_ID "TMPL39krsjNT-"
#define BLYNK_TEMPLATE_NAME "Fire Detection"
#define BLYNK_AUTH_TOKEN "tU8gZPgZL7vGC2IO3F6H15M-keaih-2J"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wokwi-GUEST"; // Change your Wifi/ Hotspot Name
char pass[] = ""; // Change your Wifi/ Hotspot Password
BlynkTimer timer;
#define fire 23
#define GREEN 12
#define RED 14
#define buzzer 13
int fire_Val = 0;
WidgetLED led(V1);
void setup() //Setup function - only function that is run in deep sleep mode
{
Serial.begin(9600); //Start the serial output at 9600 baud
pinMode(GREEN, OUTPUT);
pinMode(fire, INPUT);
pinMode(RED, OUTPUT);
pinMode(buzzer, OUTPUT);
Blynk.begin(auth, ssid, pass);//Splash screen delay
delay(2000);
timer.setInterval(500L, mySensor);
}
void loop() //Loop function
{
Blynk.run();
timer.run();
}
void mySensor()
{
fire_Val = digitalRead(fire);
if (fire_Val == LOW)
{
Serial.println("Fire in the House");
Blynk.logEvent("fire_alert", "Fire Detected");
digitalWrite(GREEN, LOW);
digitalWrite(RED, HIGH);
digitalWrite(buzzer, HIGH);
Blynk.virtualWrite(V0, 1);
Serial.print("Fire Level: ");
Serial.println(fire_Val);
led.on();
}
else
{
digitalWrite(GREEN, HIGH);
digitalWrite(RED, LOW);
digitalWrite(buzzer, LOW);
Blynk.virtualWrite(V0, 0);
Serial.print("Fire Level: ");
Serial.println(fire_Val);
led.off();
}
}