Hi everyone. I’m working with an ESP32 and a mfrc522 RFID module. In this example, I’m just trying to send to blynk that the card was read successfully, but it doesn’t seem to work.
Just does nothing.
Do you have any idea where can I be mistaken?
Thnaks in advance
#define BLYNK_TEMPLATE_ID "TMPLXKDu5xz2"
#define BLYNK_DEVICE_NAME "pControlAcceso"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define APP_DEBUG
#define USE_ESP32S2_DEV_KIT
#include "BlynkEdgent.h"
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 21
#define RST_PIN 22
MFRC522 mfrc522(SS_PIN, RST_PIN);
byte tarjetaLeida[4];
void setup()
{
Serial.begin(115200);
SPI.begin();
mfrc522.PCD_Init();
delay(100);
BlynkEdgent.begin();
}
void loop()
{
BlynkEdgent.run();
if ( ! mfrc522.PICC_IsNewCardPresent())
return;
if ( ! mfrc522.PICC_ReadCardSerial())
return;
Serial.print("UID: ");
for (byte i = 0; i < mfrc522.uid.size; i++)
{
if (mfrc522.uid.uidByte[i] < 0x10)
{
Serial.print(" 0");
}
else
{
Serial.print(" ");
}
tarjetaLeida[i] = mfrc522.uid.uidByte[i] , HEX;
Serial.print(mfrc522.uid.uidByte[i], HEX);
Serial.println();
}
Blynk.virtualWrite(V1,"Tarjeta Leida");
Serial.println();
mfrc522.PICC_HaltA();
}