Hello I have a relative simple question which is how I can save the UID from an RFID card to an SD card. I know how to do extract the uid, but I had to know how the UID should be saved on the SD card. I haven't used SD cards in any other project so far so I don't really know much about it. I have seen tutorials online but they don't explain or anything like that. So how do I save the UID, so it can be read from later and compared. With this another information would be helpful and that would be how I could read the UID. So if I have saved 100 UID's how can I "scan" the SD card for the UID? Thank you
So how do I save the UID
Is the UID a 4 byte array? Do you want to save the data as text or as binary data? If text, why?
If binary, open the file. Use a for loop to iterate over the array, write()ing one byte at a time. Close the file.
Yes it is a 4 byte but I actually don't know how I want to store it. Just so the UID gets stored and can be called when needed.
I actually don't know how I want to store it.
If you don't need to move the SD card to another computer, and make sense of the "text" in the file, store the data in binary form, using the write() method to write one byte at a time, or the other write() method to write the whole array at once.
Ok that is useful, but is there a command to scan everything on the sd card? Assuming I'm scanning a card and want to check if that UID is stored on the SD card. Is there a command to check everything or how would I do that? And also how would I save it when I wanted to see the data on my laptop? As example to see when which UID has been used to activate the system?
Ok that is useful, but is there a command to scan everything on the sd card?
You need to write one to "scan" the data the way you want it "scanned". Using a while loop to read 4 bytes at a time, while there is still data to read, is not complicated. Comparing those 4 bytes to some other array of bytes is not difficult (memcmp()).
And also how would I save it when I wanted to see the data on my laptop?
Depends on how you want to see it. If you open the file in an editor that understands binary data, you can see the 4 bytes that make up a UID.
If you want to see the data in a text editor, you need to store the data as text in the file. That makes comparing the data in the file to a UID array a lot more difficult.
Ok and would you be so nice to explain that how it works and how I then would compare it ? Or maybe give me a link to a helpful website if you don't want to write all of that down. You have helped me a lot already thanks for that
Ok and would you be so nice to explain that how it works
How what works? You haven't written any code yet.
and how I then would compare it ?
it? What is it you want to compare? Compare to what?
Post the code you have now, so we have a clue what we are working with, and how far along you are.
With how it works I was talking about how to store the UID in such a way that I can read it as Textfile on my Laptop. And with how to compare it I meant if there then would be any difference in checking the present UID with the UID stored on the SD card.