RC522 RFID read value


I want to ask for your help on how to print different value for each card serial number.
Example: I read card serial number 1 and I want to serial print text value: chemical 1
I read card serial number2 and I want to serial print text value: chemical2 and so on
Please help
I have the code to read the serial number of the card but I need to implement the scenario described.
here is the code to read and print card serial number:

#include <SPI.h>
#include <MFRC522.h>
#include <RFID.h>
#define SDA_DIO 21
#define RESET_DIO 22

const int resetPin = 22; // Reset pin
const int ssPin = 21;    // Slave select pin

MFRC522 mfrc522 = MFRC522(ssPin, resetPin); // Create instance


void setup() {


  Serial.println("Please scan the card.");


void loop()

  /* Has a card been detected? */
  if (RC522.isCard())
    /* If so then get its serial number */
    Serial.println("Card detected:");
    for (int i = 0; i < 5; i++)
      Serial.print(RC522.serNum[i], DEC);
      //Serial.print(RC522.serNum[i],HEX); //to print card detail in Hexa Decimal format


Thank you for your help!

You have a list of serial numbers in an array. You have a list of strings you want to send in an other array.

Turn the serial number from a sequence of bytes into one variable.

Search the first array for a match with your serial number. When you find it at array index X you print out the string in the position X of the second array.

And while you are at it, learn how to post code.

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the “More → Modify” option below the right hand corner of your post - to mark up your code as such using the “</>” icon in the posting window. Just highlight each section of code (or output) from the IDE and click the icon. In fact, the IDE has a “copy for forum” link to put these markings on a highlighted block for you so you then just paste it here in a posting window.

But don’t forget to use the “Auto-Format” (Ctrl-T) option first to make it easy to read. If you do not post it as “code”, it can be quite garbled and is always more difficult to read.

Also tidy up your blank space. Use blank lines only between functional blocks.