#define BLYNK_PRINT Serial
#include<SPI.h>
#include<ESP8266WiFi.h>
#include<BlynkSimpleEsp8266.h>
char auth[] = "*******************";
char ssid[] = "******";
char pass[] = "******";
int ledpin=13;
int flamepin=A0;
int flamesensorvalue=0;
void flame()
{
flamesensorvalue=analogRead(flamepin);
if (flamesensorvalue<=100)
{
Serial.println(flamesensorvalue);
digitalWrite(ledpin,HIGH);
Blynk.email("example@gmail.com", "Subject: FIRE DETECTED", "fireeee....");
}
else
{
Serial.println(flamesensorvalue);
digitalWrite(ledpin,LOW);
}
}
void setup()
{
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(flamepin,INPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}
Please format posted code properly, as required in the Welcome Topic…
you’re not calling anywhere void flame(), thus will never send any email…
study and understand how to use the blynk timer, and put flame() in a timer to run say every 1000 millis or so.
1 Like
ok…thank you…