Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 with two MFRC522 #7

Open
jhnwmr opened this issue Aug 7, 2019 · 1 comment
Open

ESP32 with two MFRC522 #7

jhnwmr opened this issue Aug 7, 2019 · 1 comment

Comments

@jhnwmr
Copy link

jhnwmr commented Aug 7, 2019

Hello,
How can I use two of the RC522?
Few uids came up, but after this period the esp32 had no reaction. Only with an restart.

Where is the problem?
So my try:

#include <Wire.h>
#include "MFRC522_I2C.h"

MFRC522 mfrc522(0x2B, 2); 
MFRC522 mfrc522_2(0x28, 2);

void setup() {
  Serial.begin(115200);           
  Wire.begin();
  mfrc522.PCD_Init();
  mfrc522_2.PCD_Init(); 
  Serial.println(F("Scan UID"));
}

void loop() {

///////////////////////// DEV 1 ////////////////////////////////
 
  if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {

  Serial.print(F("Card UID:"));
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(mfrc522.uid.uidByte[i], HEX);
  } 
  Serial.println();
  }

///////////////////////// DEV 2 ////////////////////////////////  

  if (mfrc522_2.PICC_IsNewCardPresent() && 
  mfrc522_2.PICC_ReadCardSerial()) {

  Serial.print(F("Card UID:"));
  for (byte i = 0; i < mfrc522_2.uid.size; i++) {
    Serial.print(mfrc522_2.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(mfrc522_2.uid.uidByte[i], HEX);
  } 
  Serial.println();  
  }
}

@jhnwmr jhnwmr changed the title Two MFRC522 Two MFRC522 Sep 25, 2019
@jhnwmr jhnwmr changed the title Two MFRC522 ESP32 with two MFRC522 Sep 25, 2019
@giorgio80
Copy link

same for me on esp32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants