Comments (5)
Look at the implementation of MFRC522::PICC_IsNewCardPresent()
in the .cpp
, from that I guess you will need to use:
byte bufferATQA[10];
byte bufferSize = sizeof(bufferATQA);
byte result;
...
result = mfrc522.PICC_WakeupA(bufferATQA, &bufferSize);
if (result != STATUS_OK) {
// report some issue
return;
}
...
result = mfrc522.PICC_RequestA(bufferATQA, &bufferSize);
if (result != STATUS_OK) {
// report some issue
return;
}
...
from rfid.
@omersiar : could this issue be closed now?
from rfid.
Yes it can be closed.
from rfid.
I have the same problem as @omersiar and have looked at the .cpp
but it seems I'm missing something. Currently doing it as follows:
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 13 // Configurable, see typical pin layout above
#define SS_1_PIN 2 // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 2
#define SS_2_PIN 3 // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 1
#define SS_3_PIN 4
#define SS_4_PIN 5
#define SS_5_PIN 6
#define SS_6_PIN 7
#define NR_OF_READERS 6
byte ssPins[] = {SS_1_PIN, SS_2_PIN, SS_3_PIN, SS_4_PIN, SS_5_PIN, SS_6_PIN};
byte bufferATQA[2];
byte bufferSize = sizeof(bufferATQA);
MFRC522 mfrc522[NR_OF_READERS]; // Create MFRC522 instance.
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
delay(500);
for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Init each MFRC522 card
delay(100);
Serial.print(F("Reader "));
Serial.print(reader);
Serial.print(F(": "));
mfrc522[reader].PCD_DumpVersionToSerial();
}
}
/**
Main loop.
*/
void loop() {
for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
mfrc522[reader].PICC_WakeupA(bufferATQA, bufferSize);
if (mfrc522[reader].PICC_IsNewCardPresent() && mfrc522[reader].PICC_ReadCardSerial()) {
Serial.print(F("Reader "));
Serial.print(reader);
dump_byte_array(mfrc522[reader].uid.uidByte, mfrc522[reader].uid.size);
Serial.println();
mfrc522[reader].PICC_HaltA(); //Remove so cards stay readable
mfrc522[reader].PCD_StopCrypto1();
}
}
}
void dump_byte_array(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], HEX);
}
I know I can just leave out mfrc522[reader].PICC_HaltA();
but I want more control over it, I want to keep reading all readers except those I have halted. I want to start those readers that are relevant.
from rfid.
Another user, @akellai, has created a fast_reset function, which does exactly what I wanted PICC_WakeupA to do (or expected it to do). It's perhaps a work around, but it works. Since Google led me to this question, I suspect others will find it to, so here is a link to akellai's comment and my own which is an adapted code of akellia's for multiple readers.
from rfid.
Related Issues (20)
- WARNING: Communication failure, is the MFRC522 properly connected? what is the problem?
- RC522 Mini Not Work vs RC522 Normal HOT 5
- How to get 5 bytes UID ? HOT 3
- Help i can't get the RC522 module for RFID to work. HOT 4
- Card Avaliable Function
- RFID tag shows lines "-----" instead of actual values
- Example "Minimal-SPI" does not compile HOT 1
- "the ordered comparison of pointer with integer zero" Fix for RP2040 (earlephilhower core > 3.3x)
- Help! How does the uid data is return to the buffer array in PICC_Select
- Help me? ARDUINO RC522
- Missing L1 on Hardware - please help what typ to insert...
- CardReader do not detect new cards
- Unable to read a known version from the rc522. Getting 0x89 HOT 1
- rc522 not working on esp8266 HOT 1
- Can't read payload data
- Change default factory Key
- FIRMWARE ERROR HOT 1
- Incorrect if statement on UID + BCC byte size HOT 5
- MinimalInterrupt.ino not working HOT 1
- "ordered comparison of pointer with integer zero" error ArduinoIDE / ESP32 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rfid.