Verify RFID card reader tag

I have a sparkfun RFID 13.56mHz card reader and i took an example code online that allows me to read the card tag. However, i'd like to know how do i verify the card by tapping it on the card reader and allowing it to say hi to me if it's the correct card. Here's my code:

Sorry for my bad english

rfid 13.56mhz.txt (2.77 KB)

void parse()
{

  while(rfid.available())
  {
    if(rfid.read() == 255)
    {
      for(int i=1;i<13;i++)
      {
        Str1[i]= rfid.read();             
      }
    }
  }
   
}

Please explain this bit of code.

If there is at least one byte of data to read, it is NOT OK to read 13 bytes. Array index values start at 0, not 1.

int Str1[13];
byte tag1[13] = "22A853642826";

Are these the two values that you expect to eventually compare? When they aren't even the same size?

SoftwareSerial rfid(7, 8);
SoftwareSerial xbee(10, 9);

If you are listening to the RFID reader, anything that the XBee receives will be discarded. If you are listening to the XBee, a tag scanned by the RFID reader will be discarded.

Surely you intend to listen to both at the same time, don't you? Not using an Arduino that has only one hardware serial port, you won't.

Ok, the first part about void parse(), it came with the example of the whole coding. Without that part, the rfid will not be able to scan.

int Str1[13];
byte tag1[13] = "22A853642826";

what do you mean by both are not the same size? I'm not catching what you're saying.

I also deleted the SoftwareSerial xbee(10, 9) and the rfid also stopped scanning for the card.

Sorry, I'm really new to programming arduino and this project is for my school work. Can you explain more in detail? Thanks!

it came with the example of the whole coding.

It's still crap.

what do you mean by both are not the same size? I'm not catching what you're saying.

You mean that you don't know that an int and a byte are not the same size?

I also deleted the SoftwareSerial xbee(10, 9) and the rfid also stopped scanning for the card.

You made some code changes, and now the code doesn't do what you want. What it does is a mystery as is what the code now looks like. I'm not that fond my mysteries, unless they are murder mysteries. Are you volunteering for the starring role?

You could just look at my YouTube video #34 all about RFID readers which will give you a working example, and after that expand the code to do what you want. URL in the signature of this post.