#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN_ENB 10
MFRC522 MyLectorRF(SS_PIN_ENB, RST_PIN);
String BufferID = "";
String A[2] = {"6b8b8422","a6c1b13"};
void setup() {
Serial.begin(9600);
SPI.begin();
MyLectorRF.PCD_Init();
pinMode(2,OUTPUT);
Serial.println("Control Inicializado ...");
pinMode(8,OUTPUT);
}
void loop() {
Detectar();
Verificar();
}
void Detectar()
{
while (!MyLectorRF.PICC_IsNewCardPresent()) {
delay(100);
}
// aquí ya se ha detectado una tarjeta
Serial.println("Tarjeta detectada.");
digitalWrite(2,1);
delay(500);
digitalWrite(2,0);
if ( MyLectorRF.PICC_ReadCardSerial()) {
Serial.println("Leyendo tarjeta...");
BufferID = "";
Serial.print("Card UID:");
for (byte i = 0; i < MyLectorRF.uid.size; i++) {
Serial.print(MyLectorRF.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(MyLectorRF.uid.uidByte[i], HEX);
BufferID = BufferID + String(MyLectorRF.uid.uidByte[i], HEX);
}
Serial.println();
Serial.println(BufferID);
MyLectorRF.PICC_HaltA();
}
}
void Verificar()
{
if(BufferID == A[0])
{
Serial.println("Pase");
digitalWrite(8,1);
delay(500);
digitalWrite(8,0);
}
else
{
Serial.println("..");
}
}
Estoy utililizando la libreria MFRC522 y a la hora de subir el codigo a la placa ESP32 ESP-WROOM-32 me genera un error.
adjunto
In file included from C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/Arduino.h:176,
from c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:7:
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp: In static member function 'static const __FlashStringHelper* MFRC522::GetStatusCodeName(MFRC522::StatusCode)':
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1303:29: note: in expansion of macro 'F'
case STATUS_OK: return F("Success.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1304:31: note: in expansion of macro 'F'
case STATUS_ERROR: return F("Error in communication.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1305:34: note: in expansion of macro 'F'
case STATUS_COLLISION: return F("Collision detected.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1306:32: note: in expansion of macro 'F'
case STATUS_TIMEOUT: return F("Timeout in communication.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1307:32: note: in expansion of macro 'F'
case STATUS_NO_ROOM: return F("A buffer is not big enough.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1308:38: note: in expansion of macro 'F'
case STATUS_INTERNAL_ERROR: return F("Internal error in the code. Should not happen.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1309:32: note: in expansion of macro 'F'
case STATUS_INVALID: return F("Invalid argument.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1310:34: note: in expansion of macro 'F'
case STATUS_CRC_WRONG: return F("The CRC_A does not match.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1311:35: note: in expansion of macro 'F'
case STATUS_MIFARE_NACK: return F("A MIFARE PICC responded with NAK.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1312:23: note: in expansion of macro 'F'
default: return F("Unknown error");
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp: In static member function 'static const __FlashStringHelper* MFRC522::PICC_GetTypeName(MFRC522::PICC_Type)':
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1351:39: note: in expansion of macro 'F'
case PICC_TYPE_ISO_14443_4: return F("PICC compliant with ISO/IEC 14443-4");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1352:37: note: in expansion of macro 'F'
case PICC_TYPE_ISO_18092: return F("PICC compliant with ISO/IEC 18092 (NFC)");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1353:39: note: in expansion of macro 'F'
case PICC_TYPE_MIFARE_MINI: return F("MIFARE Mini, 320 bytes");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1354:37: note: in expansion of macro 'F'
case PICC_TYPE_MIFARE_1K: return F("MIFARE 1KB");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1355:37: note: in expansion of macro 'F'
case PICC_TYPE_MIFARE_4K: return F("MIFARE 4KB");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1356:37: note: in expansion of macro 'F'
case PICC_TYPE_MIFARE_UL: return F("MIFARE Ultralight or Ultralight C");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1357:39: note: in expansion of macro 'F'
case PICC_TYPE_MIFARE_PLUS: return F("MIFARE Plus");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1358:41: note: in expansion of macro 'F'
case PICC_TYPE_MIFARE_DESFIRE: return F("MIFARE DESFire");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1359:36: note: in expansion of macro 'F'
case PICC_TYPE_TNP3XXX: return F("MIFARE TNP3XXX");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1360:39: note: in expansion of macro 'F'
case PICC_TYPE_NOT_COMPLETE: return F("SAK indicates UID is not complete.");
^
C:\Users\Marco\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8\cores\esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
c:\Users\Marco\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1362:24: note: in expansion of macro 'F'
default: return F("Unknown type");
^
exit status 1
Compilation error: exit status 1 este error genera, como puedo solucionarlo