• Hardware model + communication type. For example: ESP8266 01 WIFI
• Smartphone OS :IOS
• Blynk server region : Malaysia
• Blynk Library version : 1.1.0
hi, im having a problem, so my coding is fine but it wont send any notification to blynk, means after the card detected or not detected , blynk didnt receive any notifications, that’s the problem im occuring rn
here’s my coding :
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME ""
#define BLYNK_AUTH_TOKEN ""
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <MFRC522.h>
#include <DurianBlynkESP8266.h>
#include <SoftwareSerial.h>
#define ESP8266_BAUD 9600
#define EspSerial Serial1
#define SS_PIN 10
#define RST_PIN 9
#define trigPin 6
#define echoPin 7
#define buzzerPin 4
#define relayPin 8
#ifdef BLYNK_TEMPLATE_ID && BLYNK_TEMPLATE_NAME
char templateID[] = "";
char templateName[] = "";
#endif
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "";
char pass[] = "";
MFRC522 rfid(SS_PIN, RST_PIN);
LiquidCrystal_I2C lcd(0x27, 16, 2);
SoftwareSerial EspSerial(2, 3); // RX, TX
DBlynk DBlynk(&EspSerial);
void setup()
{
Serial.begin(9600);
EspSerial.begin(ESP8266_BAUD);
delay(10);
SPI.begin();
rfid.PCD_Init();
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(relayPin, OUTPUT);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("WELCOME");
DBlynk.begin(templateID, templateName, auth, ssid, pass);
}
void loop()
{
DBlynk.run();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("WELCOME");
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration / 2) / 29.1;
if (distance < 10 && distance > 0) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Scan Your Card");
unsigned long startTime = millis();
while (millis() - startTime < 10000) {
if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
if (verifyCard()) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Verified Card");
buzz(50, 4);
DBlynk.notify("A VERIFIED CARD HAS BEEN SCANNED");
} else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Not Real");
digitalWrite(relayPin, HIGH);
delay(1000);
digitalWrite(relayPin, LOW); // Matikan relay
DBlynk.notify("A FAKE OKU CARD HAS BEEN DETECTED");
}
delay(2000);
break;
}
}
if (millis() - startTime >= 10000) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Try Again :)");
DBlynk.notify("A CAR JUST PARKED WITHOUT A CARD");
digitalWrite(relayPin, HIGH);
delay(1000);
digitalWrite(relayPin, LOW);
delay(2000);
}
}
}
bool verifyCard() {
byte realCardID[] = {0xD9, 0x15, 0x6B, 0xB3};
if (rfid.uid.size != 0) {
if (memcmp(rfid.uid.uidByte, realCardID, rfid.uid.size) == 0) {
return true;
}
}
return false;
}
void buzz(int duration, int repeat) {
for (int i = 0; i < repeat; i++) {
digitalWrite(buzzerPin, HIGH);
delay(duration);
digitalWrite(buzzerPin, LOW);
delay(duration);
}
}