#define BLYNK_PRINT Serial
#include “blynk/blynk.h”
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
pinMode(2, INPUT_PULLDOWN);
}
int prevState = -1;
int currState = -1;
long lastChangeTime = 0;
WidgetLED led1(V0);
void checkPin()
{
int state = digitalRead(2);
// Debounce mechanism
long t = millis();
if (state != prevState) {
lastChangeTime = t;
}
if (t - lastChangeTime > 50) {
if (state != currState) {
currState = state;
Blynk.virtualWrite(V1, state);
Blynk.notify(“Check the front Door”);
led1.on();
}
else led1.off();
}
prevState = state;
}
void loop()
{
Blynk.run();
checkPin();
}
If i remove " else led1.off(); " The code runs fine. As soon as i use " else led1.off(); ". I get constant notifications in Blynk app that Particle project is taken offline. Suggestions ?