uint8_t converting to readable text?

Hi,

I have this: uint8_t key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};

How can I convert it to char or something so that I can read its contents?

have you used sprintf() ?

Typical example:

char myStr[10];  // a buffer
int myInt = 3; // a number
sprintf(myStr, %d,myInt); //convert 
Serial.println(myStr);

Well if those numbers are supposed to actually be ascii chars, then you can't.

Ascii values 0 to 20 are not readable text, they are control characters.

michinyon:
Well if those numbers are supposed to actually be ascii chars, then you can’t.

Ascii values 0 to 20 are not readable text, they are control characters.

following on from that it is also very simple to print an array of ascii values to serial monitor

for (int i = 0; i < sizeof(key); i++){
     Serial.write(key[i]);
}

using write instead of print makes a difference - see the arduino documentation for the two :slight_smile: