RFID scanner, need help!

Hey there guys,

So basically I’m using a RFID scanner, with this code at the moment: - YouTube (it’ll also be attached). But as you can see it scans the code from the tags you hold in front of it. And it’ll say a Card UID: … in the console.

Now my point is, I want with certain cards a name displayed on a LCD screen, something like this:
if (card UID: …) {
lcd.print(“NAME”);
}
of course I know that the expression in the if-statement is wrong, but I’m kinda new to the RFID and any help would be appreciated with the code!

So I scan a tag, I see the card UID in the serial print, and I want to use that Card UID for a certain name on a LCD screen.

I hope you guys can help!

RFID_code_lezer_alleen.ino (2.13 KB)

Schermafbeelding 2016-12-02 om 16.38.25.png

How do you plan to associate names with UIDs? A database? A text file on an SD card? A linked list of structures in the program? Something else (and there are many)?

The Arduino and the RFID scanner are not prescient. You have to supply the information somehow. The way that the information gets supplied is going to determine how the "if" statement gets written.

vaj4088:
How do you plan to associate names with UIDs? A database? A text file on an SD card? A linked list of structures in the program? Something else (and there are many)?

The Arduino and the RFID scanner are not prescient. You have to supply the information somehow. The way that the information gets supplied is going to determine how the "if" statement gets written.

Oh... do you know how I can do that?

Oh... do you know how I can do that?

Yes.

A database? A text file on an SD card? A linked list of structures in the program? Something else (and there are many)?

Which method do you know how to implement? How many names/cards?

PaulS:
Yes.
Which method do you know how to implement? How many names/cards?

With bytes I think, like 4 cards, maybe more.

So, you need a struct that contains a name and a byte array - the value that is associated with the name.

struct namesAndTags
{
   char name[32];
   byte tag[4];
};

Then, you create an array of tags and names:

   struct namesAndTags ValidUsers[] = { {"Jane", { 0x34, 0x45, 0x56, 0c67 },
                                           {"Dick", { 0x43, 0x54, 0x65, 0x76 }
                                       // more names and tags
                                      };

Then, when you have a tag, use a for loop to iterate over the struct array, and compare the tag to the tag field. If there is a match, print the associated name.

Thanks Paul I think I got it working now :)!