title: Working with byte array I get an "invalid conversion from char* to byte"
body: <p>I am reading and writing to an RFID tag using MFRC522.h
  I can currently read the UID of a card and dump it to "UIDChar"
  The UID of a card typically is 8 characters.</p>
  
  <pre><code>UID Example:  467EE9A9
  </code></pre>
  
  <p>I can use the mfrc522.MIFARE_SetUid function to write this UID to a new card.  In order to do this I have to set the newUID to:</p>
  
  <pre><code>0x46,0x7E,0xE9,0xA9f
  </code></pre>
  
  <p>I have written this into my code. 
  What I am wanting to do is convert the UID string into a byte array so that I can use that in place of my manually written 0x46,0x7E,0xE9,0xA9.</p>
  
  <p>I use the convert function to convert the UID into that format. 
  It can that be displayed with "buf".</p>
  
  <pre><code>Serial.println(buf);
  </code></pre>
  
  <p>Now my problem.  If I replace the</p>
  
  <pre><code>byte newUid[] = {0x46,0x7E,0xE9,0xA9f};
  </code></pre>
  
  <p>with</p>
  
  <pre><code>byte newUid[] = {buf};
  </code></pre>
  
  <p>I get the error
  invalid conversion from 'char*' to 'byte {aka unsigned char}'</p>
  
  <p>How can I set my "newUid" as "buf"?</p>
  
  <pre><code>#define SS_PIN 0  //D2
  #define RST_PIN 2 //D1
  
  #include &lt;SPI.h&gt;
  #include &lt;MFRC522.h&gt;
  
  
  /* For RFID */
  MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
  char buf[40]; // For string to byte array convertor
  
  void convert(char *s)
  {
   int i, j, k;
   buf[0] = 0x0;
  
   for (j = 0, i = 0, k = 0; j &lt; strlen(s); j++)
   {
  
     if (i++ == 0) {
       buf[k++] = '0';
       buf[k++] = 'x';
     }
  
     buf[k++] = s[j];
  
     if (i == 2) {
       if(j != strlen(s) -1)  buf[k++] = ',';
       i = 0;
     }
   }
  
  buf[k] = 0x0;
  
  }
  
  void clone() {
  
   /* RFID Read */
    // Look for new cards
    if ( ! mfrc522.PICC_IsNewCardPresent())
    {
      return;
    }
    // Select one of the cards
    if ( ! mfrc522.PICC_ReadCardSerial())
    {
      return;
    }
    //Show UID on serial monitor
    Serial.println();
    Serial.print(" UID tag :");
  
    //  Very basic UID dump
    unsigned int hex_num;
    hex_num =  mfrc522.uid.uidByte[0] &lt;&lt; 24;
    hex_num += mfrc522.uid.uidByte[1] &lt;&lt; 16;
    hex_num += mfrc522.uid.uidByte[2] &lt;&lt;  8;
    hex_num += mfrc522.uid.uidByte[3];
  
    // Get UID
    int  NFC_id = (int)hex_num;
    Serial.print(NFC_id, HEX);
  
    // Convert UID to string using an int and a base (hexadecimal)
    String stringUID =  String(NFC_id, HEX);
    char UIDChar[10];
    stringUID.toCharArray(UIDChar,10);
  
    delay(1000);
    Serial.println();
  
  
    // Convert to uppercase
    for (int i = 0; i &lt; strlen(UIDChar); i++ )
    {
      if ( UIDChar[i] == NULL ) break;
      UIDChar[i] = toupper(UIDChar[i]);
    }
  
    //Serial.print( &amp;UIDChar[0] );
    Serial.println();
    convert(UIDChar);
    Serial.println(buf);
  
     /* RFID Write */
  
     // Set new UID
     //  Change your UID hex string to 4 byte array
  
     // I get error if I use byte newUid[] = {buf};
   /*  ERROR HERE */
    byte newUid[] = {0x46,0x7E,0xE9,0xA9};
    if ( mfrc522.MIFARE_SetUid(newUid, (byte)4, true) ) {
      Serial.println( "Wrote new UID to card." );
    }
  
    // Halt PICC and re-select it so DumpToSerial doesn't get confused
    mfrc522.PICC_HaltA();
    if ( ! mfrc522.PICC_IsNewCardPresent() || ! mfrc522.PICC_ReadCardSerial() ) {
      return;
    }
  
    // Dump the new memory contents
    Serial.println( "New UID and contents:" );
    mfrc522.PICC_DumpToSerial(&amp;(mfrc522.uid));
  
  }
  
  void setup() {
  
    Serial.begin ( 115200 );
  
    /* RFID */
    SPI.begin();      // Initiate  SPI bus
    mfrc522.PCD_Init();   // Initiate MFRC522
  
    clone();
  
  }
  
  void loop() {
  
  } 
  </code></pre>