GithubHelp home page GithubHelp logo

mfrc522_i2c_library's People

Contributors

kkloesener avatar per1234 avatar semaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mfrc522_i2c_library's Issues

Use two MFRC522 with i2c

Hello,
How can I use two of the RC522?
I did try to make a second MFRC522 class and duplicated the code.

So my try:

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

#define SDA_PIN 21
#define SCL_PIN 22
#define RST_PIN 2

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

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

void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent() || ! mfrc522.PICC_ReadCardSerial() ) {
    return;
  }
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    Serial.print(mfrc522.uid.uidByte[i], HEX);
  } 
  Serial.println();

if ( ! mfrc522_2.PICC_IsNewCardPresent() || ! mfrc522_2.PICC_ReadCardSerial() ) {
    return;
  }

  for (byte i = 0; i < mfrc522_2.uid.size; i++) {
    Serial.print(mfrc522_2.uid.uidByte[i], HEX);
  } 
  Serial.println();  
}

void ShowReaderDetails() {
  byte v = mfrc522.PCD_ReadRegister(mfrc522.VersionReg);
  Serial.print(F("MFRC522 Software Version: 0x"));
  Serial.print(v, HEX);
  if (v == 0x91)
    Serial.print(F(" = v1.0"));
  else if (v == 0x92)
    Serial.print(F(" = v2.0"));
  else
    Serial.print(F(" (unknown)"));
  Serial.println("");
  if ((v == 0x00) || (v == 0xFF)) {
    Serial.println(F("WARNING: Communication failure, is the MFRC522 properly connected?"));
  }
}

void ShowReaderDetails_2() {
  byte v = mfrc522_2.PCD_ReadRegister(mfrc522_2.VersionReg);
  Serial.print(F("MFRC522 - 2  Software Version: 0x"));
  Serial.print(v, HEX);
  if (v == 0x91)
    Serial.print(F(" = v1.0"));
  else if (v == 0x92)
    Serial.print(F(" = v2.0"));
  else
    Serial.print(F(" (unknown)"));
  Serial.println("");
  if ((v == 0x00) || (v == 0xFF)) {
    Serial.println(F("WARNING: Communication failure, is the MFRC522 - 2  properly connected?"));
  }
}

The UIDs of the first device (0x2B) came up quickly, but the second device (0x28) made no output. Only if I put an nfc card on the first device, then came out an output.

Where is the problem?

no known conversion for argument 3

in code defined AKey:
MFRC522::MIFARE_Key AKey = {keyByte: {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
in code function from library:
MFRC522::StatusCode state = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 4, AKey, &(mfrc522.uid));

ERROR:
byte PCD_Authenticate(byte command, byte blockAddr, MIFARE_Key *key, Uid uid);
^
libraries\MFRC522_I2C\src\MFRC522_I2C.h:364:7: note: no known conversion for argument 3 from 'MFRC522::MIFARE_Key' to 'MFRC522::MIFARE_Key
'

exit status 1
no matching function for call to 'MFRC522::PCD_Authenticate(MFRC522::PICC_Command, int, MFRC522::MIFARE_Key&, MFRC522::Uid*)'

error: 'MFRC522' does not name a type

Hello,

In Arduino IDE and Platformio IDE i get the following Error when i just want try the demo:
MFRC522_i2c:9:1: error: 'MFRC522' does not name a type
Thanks

Compiling error In member function 'byte MFRC522::PCD_ReadRegister(byte)': warning: ISO C++ says that these are ambiguous ...

Compiling a sketch and using MFRC522_I2C_library the Arduino IDE reports this message (non blocking but present).
Can you fix it?
thanks. p.

c:\Users...\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp: In member function 'byte MFRC522::PCD_ReadRegister(byte)':
c:\Users...Arduino\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp:83:51: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
_TwoWireInstance->requestFrom(_chipAddress, _size);
^
In file included from c:\Users...\Arduino\libraries\MFRC522_I2C_Library-master\src/MFRC522_I2C.h:82:0,
from c:\Users...\Arduino\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp:10:
C:\Users...\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src/Wire.h:50:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^
C:\Users...\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src/Wire.h:47:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);
^
c:\Users...\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp: In member function 'void MFRC522::PCD_ReadRegister(byte, byte, byte*, byte)':
c:\Users...\Arduino\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp:106:52: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
_TwoWireInstance->requestFrom(_chipAddress, _count);
^
In file included from c:\Users....\Arduino\libraries\MFRC522_I2C_Library-master\src/MFRC522_I2C.h:82:0,
from c:\Users...\Arduino\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp:10:
C:\Users...\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src/Wire.h:50:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^
C:\Users...\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire\src/Wire.h:47:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);
^
c:\Users...\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp: In member function 'byte MFRC522::PCD_CommunicateWithPICC(byte, byte, byte*, byte, byte*, byte*, byte*, byte, bool)':
c:\Users...\Arduino\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp:458:20: warning: '_validBits' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (backLen < 2 || _validBits != 0) {
^
c:\Users...\Arduino\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp: In member function 'void MFRC522::PICC_DumpMifareClassicSectorToSerial(MFRC522::Uid
, MFRC522::MIFARE_Key*, byte)':
c:\Users...\Arduino\libraries\MFRC522_I2C_Library-master\src\MFRC522_I2C.cpp:1478:4: warning: 'invertedError' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (invertedError) {
^

IRQ pin for MFRC522 module

Is possible to use the IRQ pin of the module.

Right now it seams the IRQ is always low and from what I figured out is that it can be configured change state if a new RFID chip is scanned.

Does your code allow for this?

//Daniel Davidsen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.