Trouble getting RFid Cards content into variable

Hi guys,

I have a project which has a RFid reader and I need to compare whether the card content is authorized or not, but I`m having some trouble because I have no way to compare since I don't have the content available in a variable for example.

Can someone help ?
Here's a part of my code. I`ve got the code to write and to read the cards and that's already working. But I need to compare whether the content is what I want to open a door for example.

void setup() 
{ 
  Serial.begin(9600);        // Initialize serial communications with the PC
  SPI.begin();               // Init SPI bus
  mfrc522.PCD_Init();        // Init MFRC522 card
  Serial.println(F("Digite o que voce quer "));

  
 //Determina a velocidade inicial do motor 
 motor1.setSpeed(70);

 pinMode(2, INPUT);
 
}
void loop() 
{ 

// CODIGO FORA DO LE E ESCREVE

  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    le();
  }
  
  if (Serial.available() > 0) {
    // lê o primeiro byte disponível:
    teste = Serial.read();
    Serial.println(teste);
  }

  if(teste == '1'){
    escreve();
    flag1 = '1';
  }

  if(teste == '2'){
    le();
  }

 //Gira o motor no sentido horario a 90 graus
 if (digitalRead(2) == HIGH){
    motor1.step(100);
 }
   
}

Can you see the output of the RFid reader in the serial monitor to see what is being sent?

Yes, I can. This code has a function which writes an serial input into the card and another function that reads the card and outputs the info on the serial monitor. But, the card info is sent to the serial output via buffer in this part:

  byte buffer1[18];

  block = 4;
  len = 18;

  byte buffer2[18];
  block = 1;

  status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 1, &key, &(mfrc522.uid)); //line 834
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Authentication failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  status = mfrc522.MIFARE_Read(block, buffer2, &len);
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Reading failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  //PRINT CARD INFO
  for (uint8_t i = 0; i < 16; i++) {
    Serial.write(buffer2[i]); 
  }

Look that on the PRINT CARD INFO the function is printing 16 positions of an byte array called buffer2 but how can I transform it to a string for example. I need this to be able to validate a card info.

"Look that on the PRINT CARD INFO the function is printing 16 positions of an byte array called buffer2 but how can I transform it to a string for example. I need this to be able to validate a card info."

Well, I would look at capturing the output of the RFid into a string or String, then send that to the receiving end for processing out the information.

Hi zoomkat, and thank you for your help. After your suggestion Ive figured out a way to do. A String object cannot handle a byte array, but a char one. Inside the loop Ive put a char array to copy the info inside the byte array. Then I could do what u said about putting it into the String. Thank u very much.

Regards,