conversion byte vers char

Hello,
i have a array
<byte addr[8];/>
that contains address of the 1-Wire Module detected
this code

<byte i;
for( i = 0; i < 8; i++) {
Serial.write(’ ');
Serial.print(addr*, HEX);*

  • }/>*
    show in com4
    28 FF 69 92 36 16 3 E7
    I would like to have it in a char field
    rom = ‘28 FF 69 92 36 16 3 E7’
    for sending the with 433mhz
    how to do?
    best regard
    pierre

Please fix your code in the post using proper code tags :wink:

type
** **[code]** **

paste your code after that
type
** **[/code]** **

Thanks for the attempt.

// just big enough for 8 hex plus spacing plus nul character
char text[25];
// copy address to buffer in human readable format
for(int cnt=0;cnt<sizeof(address);cnt++)
{
  sprintf(&text[cnt*3], "%02x ", address[cnt]);
}
// remove last space
text[strlen(text) - 1] = '\0';

Good evening
Thank you for the quick reply
everything is working
Best regard
Pierre