Hy, i am new here. I was trying to send my room temperature by using email widgets of blynk.
I a using,
1. Arduino mega 2560
2. esp8266
esp connects to my home network. but it fails to send me mail using Blynk.email();
What should i do? please help me someone. i need it.
My code is
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
int val;
int tempPin = 1;
char auth[] = "authentication token";
char ssid[] = "ssid";
char pass[] = "password";
#define EspSerial Serial1
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
void setup()
{
Serial.begin(9600);
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
Blynk.email("mshonyw60@gmail.com", "new one", "High temperature");
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
// uncomment this to get temperature in farenhite
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
Blynk.run();
if(cel>20){
Blynk.email("mshonyw60@gmail.com", "new one", "Temperature over 28C!");
}
}