So basically I’m doing an IoT project and this is my first time. It worked well at first but then the next day the Blynk app was unable to show any notifications. I tried checking my connections but everything was fine. I tried changing Wi-Fi but it doesn’t work. I set the priority for notifications setting as high. Everything works well except for the Blynk application. Sometimes, it disconnects from the blynk app and reconnect but still no notifications. May i ask what seemed to be the problem? Because it worked at first. I’m confused why suddenly it does not work.
[13937] Connecting to blynk-cloud.com:80
[14100] Ready (ping: 58ms).
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN D4
#define RST_PIN D3
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
char auth[] = "l2AvNgrAAvaqCGDBLgs-EtD7ccxOH1X9";
char ssid[] = "Honor 10";
char pass[] = "12345678";
BlynkTimer timer;
void setup()
{
Serial.begin(9600);
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
Serial.println("Approximate your card to the reader...");
Serial.println();
pinMode(D8, OUTPUT);
pinMode(D0, OUTPUT);
pinMode(D2, OUTPUT);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L,notify);
}
void loop()
{
Blynk.run();
timer.run();
}
void notify()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content = "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == "92 6C 8D 47")
{
Serial.println("Authorized access");
Serial.println();
Blynk.notify("(2180176) CHECKED IN");
digitalWrite(D8, HIGH);
digitalWrite(D2, HIGH);
delay(100);
digitalWrite(D8, LOW);
digitalWrite(D2, LOW);
delay(100);
digitalWrite(D8, HIGH);
digitalWrite(D2, HIGH);
delay(100);
digitalWrite(D8, LOW);
digitalWrite(D2, LOW);
delay(100);
delay(2000);
}
else if (content.substring(1) == "42 8F 89 47")
{
Serial.println("Authorized access");
Serial.println();
Blynk.notify("(2180178) CHECKED IN");
digitalWrite(D8, HIGH);
digitalWrite(D2, HIGH);
delay(100);
digitalWrite(D8, LOW);
digitalWrite(D2, LOW);
delay(100);
digitalWrite(D8, HIGH);
digitalWrite(D2, HIGH);
delay(100);
digitalWrite(D8, LOW);
digitalWrite(D2, LOW);
delay(100);
delay(2000);
}
else {
Serial.println(" Access denied");
Blynk.notify("Unregistered Card");
digitalWrite(D8, HIGH);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(100);
digitalWrite(D0, HIGH);
delay(100);
digitalWrite(D0, LOW);
delay(1000);
digitalWrite(D8, LOW);
}
}