Esp8266-12e simple notification [SOLVED]

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

First of all to help us read it:

The issue I can see is this line

// Wait until connected }

Change it to this:

// Wait until connected 
}

also this:

if (isButtonPressed); {

remove the ;


Edited for you:

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

Ignoring the push notify function… are you getting “Button is pressed.” in the serial monitor when pin 5 is active?

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.

Thank you for your Help…
I do appreciate it…

I am also facing same problem.
I think you forgot to add
timer.run();
In void loop

but he’s not using any timers, so doesn’t need timer to be in the loop?

1 Like

well, what are the app settings? post screenshot

He is not constantly sending data. He is only sending to blynk on interupt change so no need for a timer.

then I believe you have hit your push notification limit each 60 seconds,

I am not getting notifications when hardware goes offline.

have you started a new thread elsewhere in this forum?

sounds like the most obvious answer!!!

1 Like

Bit off topic mate… start a new topic for your issue.

i wish there was a ‘reply’ with quote’ button on this forum, it would make it a bit less confusing …

1 Like