ButtonInterrupt Example is Resetting ESP8266

Hello I have used 2 of my Espert V2 board and NodeMCU V2 board testing the example from Blynk using button interrupt.
I seems to reset both of my board and will not send email.
Only the “Button is pressed.” is sent via serial.

2nd example checkPin() would also reset.

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
{
Serial.println(“Button is pressed.”); // This can be seen in the Serial Monitor
Blynk.email("@yahoo.com,@yahoo.com", “Subject: Button Logger”, “You just pushed the button…”);

}
}

void checkPin()
{
// Invert state, since button is “Active LOW”
if (digitalRead(2)) {
led1.off();
} else {
led1.on();
}
}

@victagayun Many of the Blynk examples are for regular Arduino’s using Ethernet and ESP’s are subtly different to Arduino’s.

The recommendation is to look at rising and falling rather than change and detach the interrupt between the rise and fall etc.

Don’t do anything within the interrupt call other than set a flag and then use the status of the flag outside the interrupt to do something.

Without this the ESP struggles with the interrupt calls.

HTH

I think interrupt would not be reliable for some emergency applications.
So I guess, polling would only be the better option, I would be polling 6 switches, any recommendation for a debounce library?

I would rather make the hardware do the debounce. Something like this

Or this:

See Bill Rowe

In my opinion more reliable than software debouncing :slight_smile: