Error shown is this c:\Users\Zarulmiqhail\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 9
#define SS_PIN 10

MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {
Serial.begin(9600);
while (!Serial);
SPI.begin();
mfrc522.PCD_Init();
delay(4);
mfrc522.PCD_DumpVersionToSerial();
Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
}

void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}

if ( ! mfrc522.PICC_ReadCardSerial()) {
	return;
}

mfrc522.PICC_DumpToSerial(&(mfrc522.uid));

}

Welcome to the forum

You started a topic in the Uncategorised category of the forum when its description explicitly tells you not to

Your topic has been moved to a relevant category. Please be careful in future when deciding where to start new topics

Please post your sketch, using code tags when you do. This prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

what microcontroller are you using?
what Tools>Board have you selected?
what version of the Arduino IDE are you using?
if I select Tools>Board ESP32 Dev module your code compiles and links OK
post the full error message (copy the text and post using code tag </>)

microcontroller: esp32 v1
board: DOIT ESP32 DEVKIT V1
Aduino IDE : 2.3.3

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 9
#define SS_PIN 10

MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {
Serial.begin(9600);
while (!Serial);
SPI.begin();
mfrc522.PCD_Init();
delay(4);
mfrc522.PCD_DumpVersionToSerial();
Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
}

void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}

if ( ! mfrc522.PICC_ReadCardSerial()) {
	return;
}

mfrc522.PICC_DumpToSerial(&(mfrc522.uid));

}

I already switch to Esp dev module and its still error

Check your library, be sure it's the right one. The one that links from here:
https://docs.arduino.cc/libraries/mfrc522/
to this page:
https://github.com/miguelbalboa/rfid
also indicates

Arduino library for MFRC522 and other RFID RC522 based modules.
Read and write different types of Radio-Frequency IDentification (RFID) cards on your Arduino using a RC522 based reader connected via the Serial Peripheral Interface (SPI) interface.
For advanced and further development please use library RFID_MFRC522v2.

so you may need to go to that link, as it has the correct pin assignments for the ESP32 which I think you need.

Also, where are you storing your libraries?
Most of the time, or at least it used to be the case, that your contributed libraries should be stored in a folder named libraries inside you sketchbook folder, for easy portability. At least, that's how I still so it and it works great for moving stuff around, just copy-paste the whole sketchbook to whatever machine you're moving to.

Just be sure that the Arduino IDE knows where you keep things under File>Preferences>sketchbook location in the settings tab.

So mine looks like this:

c:\Users\Hallowed31\Documents\Arduino\sketchbook

and I keep my libraries inside that sketchbook folder in its own folder named libraries, counter-intuitive though that may seem.

Good luck.

c:\Users\Zarulmiqhail\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522Extended::TCL_Transceive(TagInfo*, byte*, byte, byte*, byte*)':
c:\Users\Zarulmiqhail\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\Zarulmiqhail\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)) {
| ~~~~~~^

exit status 1

Compilation error: exit status 1

it is yet another problem with ESP32 core V3.x
you need to edit one of the MFRC522 library files

// in file Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp
// Line: 824 and 847
//    replace: if (backData && (backLen > 0))
//    by : if (backData && backLen != nullptr)

EDIT: or you could try rfid_mfrc522v2 library

1 Like

For which board are you compiling?
Which MFRC522 library are you using (just in case there are multiple)?

I have merged your cross-posts @zarul2210 .

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

@zarul2210 Did you miss the request to use code tags when posting code ?

im using esp32 v1

Did you ignore the advice in post #9?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.