Getting value from function

This function prints the name of the tag like → 5C 7H 5A 31
How can i put the name into a variable to use it later
Like sending it via bluetooth to a mobile etc …

void get_RFID_name ()
{
  
  // Look for new cards
  if ( ! rfid.PICC_IsNewCardPresent())
    return;

  // Verify if the NUID has been readed
  if ( ! rfid.PICC_ReadCardSerial())
    return;

 for (byte i = 0; i < 4; i++) {
      nuidPICC[i] = rfid.uid.uidByte[i];
    }
   
  printHex(rfid.uid.uidByte, rfid.uid.size);
    Serial.println();
   rfid.PICC_HaltA();
  rfid.PCD_StopCrypto1();
}

void printHex(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    Serial.print(buffer[i], HEX);
  }
  }

Hi,
This reference may help;

https://www.arduino.cc/reference/en/language/structure/control-structure/return/

or google

returning values from arduino functions

Tom... :slight_smile:

for (byte i = 0; i < 4; i++) {
      nuidPICC[i] = rfid.uid.uidByte[i];
    }

It appears to already be putting that into a global array called nuidPICC. You should be able to use that variable elsewhere in the code judging by the way it is used here. You shouldn’t need to change anything about this function.

Of course, for more specific help, always post your complete code.