can anyone tell me why this doesn’`t work it compiles and uploads fine. in the serial monitor it says it connected to wifi and blink. if i unplug the nodemcu it will display device disconnected, but it never sends an email. it should send an email as soon as it connects correct???
here is the code:
// put your main code here, to run repeatedly:
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = " removed but correct in sketch ";
void emailOnButtonPress()
{
// *** WARNING: You are limited to send ONLY ONE E-MAIL PER MINUTE! ***
// Let’s send an e-mail when you press the button
// connected to digital pin 2 on your Arduino
int isButtonPressed = !digitalRead(2); // Invert state, since button is “Active LOW”
if (isButtonPressed) // You can write any condition to trigger e-mail sending
{
BLYNK_LOG(“Button is pressed.”); // This can be seen in the Serial Monitor
Blynk.email(“removed but correct in sketch t”, “Subject: Button Logger”, “You just pushed the button…”);
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, “2WIREXXX”, “removed but correct in sketch”);
while (Blynk.connect() == false) {
// Wait until connected
}
// Send e-mail when your hardware gets connected to Blynk Server
// Just put the recepient’s “e-mail address”, “Subject” and the “message body”
Blynk.email(“removed but correct in sketch t”, “Subject”, “My Blynk project is online.”);
// Setting the button
pinMode(2, INPUT_PULLUP);
// Attach pin 2 interrupt to our handler
attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);
}
void loop()
{
Blynk.run();
}