BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

I m trying to get email notification when fire detected ...but i m not getting..here is my code please correct me


#1
#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();
}


#2

Please format posted code properly, as required in the Welcome Topic…

Blynk - FTFC


#3

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.


#4

ok…thank you…:blush: