Al compilar un scketch que utiliza la libreria MFRC532 me da el siguiente error de compilacion.
c:\Users\Hern�n Camusso\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522Extended::TCL_Transceive(TagInfo*, byte*, byte, byte*, byte*)':
c:\Users\Hern�n Camusso\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp:824:34: error: ordered comparison of pointer with integer zero ('byte*' {aka 'unsigned char*'} and 'int')
824 | if (backData && (backLen > 0)) {
| ~~~~~~~~^~~
c:\Users\Hern�n Camusso\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp:847:42: error: ordered comparison of pointer with integer zero ('byte*' {aka 'unsigned char*'} and 'int')
847 | if (backData && (backLen > 0)) {
| ~~~~~~~~^~~
Usando librería SPI con versión 3.0.5 en la carpeta: C:\Users\Hernán Camusso\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.5\libraries\SPI
Usando librería MFRC522 con versión 1.4.11 en la carpeta: C:\Users\Hernán Camusso\Documents\Arduino\libraries\MFRC522
grpc: error while marshaling: string field contains invalid UTF-8
Compilation error: grpc: error while marshaling: string field contains invalid UTF-8
Si posteas en el foro en inglés usa ese idioma, sino postea en este foro usando español.
Agrega tu código completo para poder indicarte mejor sobre el problema que tienes, usa etiquetas de código.
Lee las normas.
Ahora tu problema
backLen es un puntero (byte*) y no un entero como la otra variable por eso te dice, comparas o pretendes comparar un puntero byte * con un int (entero).
Linea 824 y 847
Claro, leí esa descripción del puntero, pero esa parte del código entiendo que viene en la librería, es decir no es escrita por mi. El código que yo "escribí " en la ide s el siguiente:
/*
* Initial Author: ryand1011 (https://github.com/ryand1011)
*
* Reads data written by a program such as "rfid_write_personal_data.ino"
*
* See: https://github.com/miguelbalboa/rfid/tree/master/examples/rfid_write_personal_data
*
* Uses MIFARE RFID card using RFID-RC522 reader
* Uses MFRC522 - Library
* -----------------------------------------------------------------------------------------
* MFRC522 Arduino Arduino Arduino Arduino Arduino ESP32
* Reader/PCD Uno/101 Mega Nano v3 Leonardo/Micro Pro Micro NodemCU
* Signal Pin Pin Pin Pin Pin Pin GPIO(pin)
* -----------------------------------------------------------------------------------------
* RST/Reset RST 9 5 D9 RESET/ICSP-5 RST 17(11)
* SPI SS SDA(SS) 10 53 D10 10 10 5(10)
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16 23(2)
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14 19(8)
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15 18(9)
*
* More pin layouts for other boards can be found here: https://github.com/miguelbalboa/rfid#pin-layout
*/
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 17 // Configurable, see typical pin layout above
#define SS_PIN 5 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
//*****************************************************************************************//
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println(F("Read personal data on a MIFARE PICC:")); //shows in serial that it is ready to read
}
//*****************************************************************************************//
void loop() {
// Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
MFRC522::MIFARE_Key key;
for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;
//some variables we need
byte block;
byte len;
MFRC522::StatusCode status;
//-------------------------------------------
// Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
//Serial.println(F("**Card Detected:**"));
//-------------------------------------------
//mfrc522.PICC_DumpDetailsToSerial(&(mfrc522.uid)); //dump some details about the card
//mfrc522.PICC_DumpToSerial(&(mfrc522.uid)); //uncomment this to see all blocks in hex
//-------------------------------------------
// Serial.print(F("Color: "));
byte buffer1[18];
block = 4;
len = 18;
//------------------------------------------- GET Bloque 4 COLOR
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 4, &key, &(mfrc522.uid)); //line 834 of MFRC522.cpp file
if (status != MFRC522::STATUS_OK) {
Serial.print(F("Authentication failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
status = mfrc522.MIFARE_Read(block, buffer1, &len);
if (status != MFRC522::STATUS_OK) {
Serial.print(F("Reading failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
//PRINT color
for (uint8_t i = 0; i < 16; i++)
{
if (buffer1[i] != 32)
{
Serial.write(buffer1[i]);
}
}
// Serial.write(" ");
delay(500); //change value if you want to read cards faster
mfrc522.PICC_HaltA();
mfrc522.PCD_StopCrypto1();
}
//*****************************************************************************************//