Ciao ragazzi ho un problema grosso utilizzando questo codice e facendo la prova collegando il pin 2 al gnd ad un pulsante la notifica arriva ma quando provo 2 o 3 volte l’arduino di blocca e mi risulta offline. quindi devo riavviarlo. come mai? dove sbaglio. grazie
Hello guys I have a big problem using this code and doing the test connecting pin 2 to GND to a notification button comes But when I try 2 or 3 times the LOCK Arduino and I know offline. so I have to restart it. Why? where I’m wrong. Thank you
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxx";
void notifyOnButtonPress()
{
// Invert state, since button is "Active LOW"
int isButtonPressed = !digitalRead(2);
if (isButtonPressed) {
Serial.println("Button is pressed.");
// Note:
// We allow 1 notification per 15 seconds for now.
Blynk.notify("Yaaay... button is pressed!");
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
while (Blynk.connect() == false) {
// Wait until connected
}
// Setup notification button on pin 2
pinMode(2, INPUT_PULLUP);
// Attach pin 2 interrupt to our handler
attachInterrupt(digitalPinToInterrupt(2), notifyOnButtonPress, CHANGE);
}
void loop()
{
Blynk.run();
}