Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Example Using Read And Using Write #18

Closed
NinjaJake86 opened this issue Jan 12, 2014 · 1 comment
Closed

Simple Example Using Read And Using Write #18

NinjaJake86 opened this issue Jan 12, 2014 · 1 comment

Comments

@NinjaJake86
Copy link

hi guys!

i brought an rfid reader which supports this library and some read/write RFID cards, I've looked through your examples and i just can't understand the library, all i want to do is have it so when it reads a certain card number in output another number on the serial line (e.g. 0, 1, 2, etc)

can someone please explain to me how to write a sketch where i can simply put the card number which i want to be written ether in a INT at the top of the sketch or send it to the arduino via serial AND an example/explanation of how to use read the RFID card properly/simply so i can make the sketch i previously mentioned

thanks guys!

@WA4OSH
Copy link
Contributor

WA4OSH commented Apr 14, 2014

NinjaJake86,
I decided to help out a little with this project. Sorry that it took so long for someone to get back to you.

Take a look at the simplest example -- cardRead.ino It reads the card and determines if the checksum is valid. Then it prints the card number on the console. For as long as the same card is being read, the console will continue to print commas.

Now if I understand you right, you would like to have a "database" in your sketch that has in it columns of cards that are "registered" on your card reader. And each row of that data base is one card. It has a list of 5 integers as its unique ID and say a list of characters you want to print out.

Since you probably won't have a huge database of RFID card users for the first cut of this project, use the sketch above and detect a card being swiped. Next, use a sequential search (a while loop) to look down the rows of your "database" and look to match all five of the card's integers to the "database"'s list of integers. I would write a method that compares two lists for this. If you found a match, break out of the loop and print to the console the string that matches the card's numbers. Note that the string could be just a member or employee number, or their name.

Once you get it to work, you can also print that string to an LCD display with a welcome message, and/or record a time and date code into another list in the database. Once your search takes "too long", you can refactor by sorting your "database" and doing a binary search of some sort.

I hope this gives you a hint on how to proceed with your project if you haven't figured it out yet.

Konrad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants