title: Arduino RC522 Bytes and hex
body: <p>I'm quite new to the RFID scene and I need some help!
  I need to get the values of my cards from my RC522 and they need to look like this.</p>
  
  <p>Example 1:</p>
  
  <pre><code>byte card1[5] = {0xAD,0xB2,0xDB,0xEA,0x3E}; // card1
  </code></pre>
  
  <p>But at the moment I can only seem to get it to print the values out as decimals!
  like this.</p>
  
  <p>Example 2:</p>
  
  <pre><code>173 , 178 , 219 , 234 , 46 
  </code></pre>
  
  <p>How do I get the serial numbers of the cards like in the first example?</p>
  
  <p>UPDATE</p>
  
  <pre><code> Serial.print("     ");
   if(data[0] &lt; 16){
   Serial.print("0");
  }
  Serial.print(data[0],HEX);
  
  if(data[1] &lt; 16){
  Serial.print("0");
  }
  Serial.print(data[1],HEX);
  
  if(data[2] &lt; 16){
  Serial.print("0");
  }
  Serial.print(data[2],HEX);
  
  if(data[3] &lt; 16){
  Serial.print("0");
  }
  Serial.print(data[3],HEX);
  
  if(data[4] &lt; 16){
  Serial.print("0");
  }
  </code></pre>
  
  <p>This is the code used for the arrays</p>
  
  <pre><code>  if (rfid.isCard()){ // Found valid card
  if (rfid.readCardSerial()){ // Reads the card
    delay(1000);
    data[0] = rfid.serNum[0]; // Array's for Card serial number.
    data[1] = rfid.serNum[1];
    data[2] = rfid.serNum[2];
    data[3] = rfid.serNum[3];
    data[4] = rfid.serNum[4];
  }
  </code></pre>
  
  <p>**</p>
  
  <h2>EDIT 2</h2>
  
  <p>**</p>
  
  <p><strong>original code for example 2</strong></p>
  
  <pre><code>#include &lt;SPI.h&gt;
  #include &lt;RFID.h&gt;
  
  RFID rfid(10,5); 
  
  void setup()
  { 
  Serial.begin(9600);
  SPI.begin(); 
  rfid.init();
  
  }
  
  void loop()
  {
  if (rfid.isCard()) {
  
        Serial.println("IS CARD");
  
        if (rfid.readCardSerial()) {
  
                      Serial.println(" ");
                      Serial.println("The serial number of the card is  : ");
          Serial.print(rfid.serNum[0],DEC);
                      Serial.print(" , ");
          Serial.print(rfid.serNum[1],DEC);
                      Serial.print(" , ");
          Serial.print(rfid.serNum[2],DEC);
                      Serial.print(" , ");
          Serial.print(rfid.serNum[3],DEC);
                      Serial.print(" , ");
          Serial.print(rfid.serNum[4],DEC);
                      Serial.println(" ");
                      delay(1555); // Delay before reading again
  
  
        }
  
  }
  
  rfid.halt();
  }
  </code></pre>