Go Down

Topic: RFID RC522 - Card Read not working (Read 87 times) previous topic - next topic

rickyduino

Hi.
I bought a card reader rfid rc522 and I have to read the code of the card master.
I tried to use the example of the library rc522 "card read" but when I upload it the IDE repors this bugs:


Arduino:1.6.5 (Windows 8.1), Scheda:"Arduino Uno"

RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::RFID(int, int)'
RFID.cpp.o:C:\Users\GHOST_~1\AppData\Local\Temp\build8939103010449205166.tmp/RFID.cpp:22: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::RFID(int, int)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::writeMFRC522(unsigned char, unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::reset()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::readMFRC522(unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::setBitMask(unsigned char, unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::antennaOn()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::init()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::clearBitMask(unsigned char, unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::calculateCRC(unsigned char*, unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::MFRC522ToCard(unsigned char, unsigned char*, unsigned char, unsigned char*, unsigned int*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::MFRC522Request(unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::isCard()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::anticoll(unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::readCardSerial()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::auth(unsigned char, unsigned char, unsigned char*, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::read(unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::write(unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::halt()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "RFID.h"

Used: C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522

Not used: C:\Program Files (x86)\Arduino\libraries\RFIDRC522

Errore durante la compilazione
-------------------------------------------------------------------------------------------------------------------

How can I solve this problem? Or how can I read the code of the Card Master?

Thanks. Ricky

JohnLincoln

......

Multiple libraries were found for "RFID.h"

Used: C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522

Not used: C:\Program Files (x86)\Arduino\libraries\RFIDRC522

Errore durante la compilazione
-------------------------------------------------------------------------------------------------------------------

How can I solve this problem? Or how can I read the code of the Card Master?

Thanks. Ricky
It looks as though your problem is due to having 2 copies of the RFIDRC522 library on your PC.

Try renaming the one described as unused to something else, or even remove it completely.

rickyduino

I tried to delete the unused library but I have the same error.

Arduino:1.6.5 (Windows 8.1), Scheda:"Arduino Uno"

RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::RFID(int, int)'
RFID.cpp.o:C:\Users\GHOST_~1\AppData\Local\Temp\build2482321284805536167.tmp/RFID.cpp:22: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::RFID(int, int)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::writeMFRC522(unsigned char, unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::reset()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::readMFRC522(unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::setBitMask(unsigned char, unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::antennaOn()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::init()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::clearBitMask(unsigned char, unsigned char)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::calculateCRC(unsigned char*, unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::MFRC522ToCard(unsigned char, unsigned char*, unsigned char, unsigned char*, unsigned int*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::MFRC522Request(unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::isCard()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::anticoll(unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::readCardSerial()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::auth(unsigned char, unsigned char, unsigned char*, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::read(unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::write(unsigned char, unsigned char*)'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
RFIDRC522\RFID.cpp.o: In function `RFID::RFID(int, int)':
C:\Users\GHOST_ADM\Documents\Arduino\libraries\RFIDRC522/RFID.cpp:22: multiple definition of `RFID::halt()'
RFID.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI/SPI.h:209: first defined here
collect2.exe: error: ld returned 1 exit status
Errore durante la compilazione

-------------------------------------------------------------------------------------------------------------------------

I also tried an other sketch that I found on a forum:

#include <SPI.h>
#include <RFID.h>
/* Vengono definiti PIN del RFID reader*/
#define SDA_DIO 10  // 53 per Mega
#define RESET_DIO 9
#define delayRead 1000 // Time of delay

/* Viene creata una istanza della RFID libreria */
RFID RC522(SDA_DIO, RESET_DIO);

void setup()
{
 Serial.begin(9600);
 /* Abilita SPI*/
 SPI.begin();
 /* Viene inizilizzato RFID reader */
 RC522.init();
 Serial.println("Setup");
}

void loop()
{
 /* Temporary loop counter */
 byte i;

 // Se viene letta una tessera
 if (RC522.isCard())
 {
   // Viene letto il suo codice
   RC522.readCardSerial();
   String codiceLetto ="";
   Serial.println("Codice delle tessera letto:");

   // Viene caricato il codice della tessera, all'interno di una Stringa
   for(i = 0; i <= 4; i++)
   {
     codiceLetto+= String (RC522.serNum,HEX);
     codiceLetto.toUpperCase();
   }
   Serial.println(codiceLetto);
   delay(delayRead);
   Serial.println();
   Serial.println();
 }
}

-------------------------------------------------------------------------------------------------------------------------

It uploads on the board but nothing happends.
So now I don't know where's the problem; if it's that I have a broken shield or I have to redo the welding or I connect bad the board or... I don't know!!

Go Up