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

Issue with Blynk Example "Simple push notification example"

Hello,

I’m trying to use the “Simple push notification example” from the Blynk Example Code Generator with an ESP32 and Arudino IDE, but I simply don’t get it to run.

I’m quite new to the topic in general and I guess it’s actually not a Blynk-specific issue, but since it’s concerning the Blynk Example code, maybe someone else already ran into this problem.
And I just have no idea how to continue otherwise or debug this, since I’m still a little noob :slight_smile:

In the meantime, I modified the code a bit by setting a variable for the Button Pin and changed the Pin to 23, since the GPIO2 seems to not work properly on my board, but I also checked it by using the default example.

I tried several other pins, adding delays, changing the interrupt method and some other things, but as soon as the button is pressed (or actually: button pin connected to GND), it simply breaks.
Sometimes it restarts afterwards automatically and other times it doesn’t.

Serial Monitor output:

[25] Connecting to xxx
[635] Connected to WiFi
[635] IP: xx.xx.xx.xx
[635] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP32

[707] Connecting to blynk-cloud.com:80
[874] Ready (ping: 40ms).
Button is pressed.
Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x4008c18a  PS      : 0x00060534  A0      : 0x8008b3a3  A1      : 0x3ffbfb30  
A2      : 0x3ffcb880  A3      : 0x3ffbc77c  A4      : 0x00000001  A5      : 0x00000001  
A6      : 0x00060523  A7      : 0x00000000  A8      : 0x3ffbc77c  A9      : 0x3ffbc77c  
A10     : 0x00000019  A11     : 0x00000019  A12     : 0x00000001  A13     : 0x00000001  
A14     : 0x00060521  A15     : 0x00000000  SAR     : 0x0000000a  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  
Core 1 was running in ISR context:
EPC1    : 0x4012ad53  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x4008c18a

ELF file SHA256: 0000000000000000

Backtrace: 0x4008c18a:0x3ffbfb30 0x4008b3a0:0x3ffbfb50 0x400896d7:0x3ffbfb70 0x4012acd1:0x3ffbfbb0 0x4011845b:0x3ffbfbd0 0x40117cd9:0x3ffbfc00 0x40118209:0x3ffbf

Code:

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";
int buttonPin = 23;

void notifyOnButtonPress()
{
  // Invert state, since button is "Active LOW"
  int isButtonPressed = !digitalRead(buttonPin);
  if (isButtonPressed) {
    Serial.println("Button is pressed.");

    // Note:
    //   We allow 1 notification per 5 seconds for now.
    Blynk.notify("Yaaay... button is pressed!");

    // You can also use {DEVICE_NAME} placeholder for device name,
    // that will be replaced by your device name on the server side.
    //Blynk.notify("Yaaay... {DEVICE_NAME}  button is pressed!");
  }
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup notification button on buttonPin
  pinMode(buttonPin, INPUT_PULLUP);
  // Attach pin buttonPin interrupt to our handler
  attachInterrupt(digitalPinToInterrupt(buttonPin), notifyOnButtonPress, CHANGE);
}

void loop()
{
  Blynk.run();
}

Any help is appreciated!

Thanks
Moe

Yes, there seems to be a problem when trying to send notifications with the ESP32. I initially suspected it was an interrupt issue, but commenting-out the Blynk.notify command prevents the ESP crashing.

@vshymanskyy, @Dmitriy is this something you are aware of?

Pete.

1 Like