Go Down

Topic: Mifare RFID-RC522 (Read 6486 times) previous topic - next topic

Oso57

Hi...
I'm newbie to arduino.

I've got a Mifare RFID-RC522 reader -writer.
With some examples I found on the internet I managed to read the serial number of the cards, but ...
Anybody can explain like a fool how I can write and read data on the cards? or Where I can get examples to do?

Thanks in advance.

rena

Check this sketch: https://github.com/rena2019/myarduino/blob/master/RC522DumpMifare.ino

Oso57

#2
Oct 10, 2013, 06:47 pm Last Edit: Oct 10, 2013, 08:24 pm by Oso57 Reason: 1
Thanks Rena...
But this example is more complex for me.
Do not exist any library for read-write data more simple?

Greetings.


rena



But this example is more complex for me.
Do not exist any library for read-write data more simple?

Greetings.

to complex? The sketch is a one-file-solution: the lib-functions to talk to the board are included, that's why it looks so complex.
You can replace the loop function with the following (untested) code:

void loop()
{
    uchar buffer[MAX_LEN];
    int block=0; //TODO: your block number
    if (selectCard(true) &&
         MFRC522_Auth(PICC_AUTHENT1A, block, defaultKeyA, serNum) == MI_OK &&
         MFRC522_Read(block, buffer) == MI_OK)
     {
            //TODO: block buffer contains the read data
     }
}

if you want to read 1 block only

     

timiti29

Hi, I've test the code and it's working.
i can read all block of the Token.

So, now the question is : can you explain the use of the function Auth,
we need to send defaultKeyA table, what is the content of the table ? what this table is it?

Thank you.
Timiti29

Oso57

Hello...

Thanks for your kindness

And to write?
I can not find the way

Greetings.


rena


And to write?
I can not find the way

Fill the buffer with the data you want to write and then use MFRC522_Write instead of MFRC522_Read from my sample code above (select,auth,write)

Oso57


Thanks again for your kindness.


I am learning.

Greetings

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy