Can some one help me out. I am trying to use the esp8266-12e, to send A simple notification.
After pin 5 goes low, no notification is sent.
If I take off the // one this line in the code. //Blynk.notify(“Device NOTE”);
The notification works, if you reset the module, or if pin 5 goes low.
But still the one thats not working is.
Blynk.notify(“This one not working, WHY”); }
code:
#define BLYNK_PRINT Serial // Comment this out to disable prints and save
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
void notifyOnButtonPress()
{
// Invert state, since button is "Active LOW" int isButtonPressed = !digitalRead(5);
if (isButtonPressed); {
Serial.println("Button is pressed.");
//Not working when pin 5 goes low..................
Blynk.notify("This one not working, WHY"); }
}
void setup()
{
Serial.begin(9600); Blynk.begin(auth, "XXXXXXXXX", "XXXXXXXXXXXX");
while (Blynk.connect() == false) {
// Wait until connected }
// Setup notification button on pin 5 pinMode(5, INPUT_PULLUP);
// Attach pin 5 interrupt to our handler
// This is the line that will make the push notification
// work (send it from esp12e to ipod blynk app)
//Blynk.notify("Device NOTE");
attachInterrupt(digitalPinToInterrupt(5), notifyOnButtonPress, CHANGE);
}
void loop()
{
Blynk.run();
}
#define BLYNK_PRINT Serial // Comment this out to disable prints and save
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
void notifyOnButtonPress() {
// Invert state, since button is "Active LOW"
int isButtonPressed = !digitalRead(5);
if (isButtonPressed){
Serial.println("Button is pressed.");
Blynk.notify("Button is pressed.");
}
}
void setup() {
Serial.begin(9600);
Blynk.begin(auth, "XXXXXXXXX", "XXXXXXXXXXXX");
while (Blynk.connect() == false) {
// Wait until connected
}
attachInterrupt(digitalPinToInterrupt(5), notifyOnButtonPress, CHANGE);
}
void loop(){
Blynk.run();
}
the issues youre having come from syntax errors… tbh im surprised it compiled
also bare in mind you can only send 1 push notification every 60 sec
Here is the code, I just tried. It only works if I put in the same line in.
Blynk.notify(“Device started”);
When pin 5 goes low the push notification on ipad reads (Device started)
If I take out this line Blynk.notify(“Device started”); and pin 5 goes low or high,
no push notification on ipad.
Why is it not reading the Blynk.notify after the if statement?
#define BLYNK_PRINT Serial // Comment this out to disable prints and save
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
void notifyOnButtonPress() {
// Invert state, since button is "Active LOW"
int isButtonPressed = !digitalRead(5);
if (isButtonPressed){
Serial.println("Button is pressed.");
Blynk.notify("Button is pressed.");
}
}
void setup() {
Serial.begin(9600);
Blynk.begin(auth, "xxxxxxxxxxxxxxxx", "xxxxxxxxxxxx");
while (Blynk.connect() == false) {
// Wait until connected
}
Blynk.notify("Device started");
pinMode(5, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(5), notifyOnButtonPress, CHANGE);
}
void loop(){
Blynk.run();
}
Yes I am getting “Button is pressed.” , I noticed last time I compiled the code, it said
(Multiple libraries were found for “BlynkSimpleEsp8266.h”
This might be what is wrong…
I will try to fix this and then I will get back on here if it is what is wrong or right.