I have issues trying to use a CPX with an RFID-RC522 module. I am using an Arduino code, no python, and the problem is that the RFID module is not reading a card, and I am using a card made for the RFID module. Specifically the card is not read by the CPX and I don't know what is the problem.
To have more details I am going to insert my code, thank you and have a good day.
Code: Select all
#include <SPI.h>
#include <MFRC522.h>
#include <Adafruit_CircuitPlayground.h>
#include <iostream>
using namespace std;
#define RST_PIN A4 // Reset
#define SS_PIN A5 //SS (SDA) of RC522
MFRC522 mfrc522(A5, A4); //Object to RC522
void setup() {
CircuitPlayground.begin();
Serial.begin(9600);
SPI.begin();
mfrc522.PCD_Init();
}
int j = 0;
void loop() {
// Check the new cards
if(!mfrc522.PICC_IsNewCardPresent()) {
Serial.print("Bye\n");
return;
}
if (!mfrc522.PICC_ReadCardSerial()) {
Serial.print("Bye2\n");
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
}