uint8_t data[] = "AA" + String(msg_counter , DEC);

Hi,
What is the error? What am I doing wrong?
I need to use uint8_t for data transfer (array of 8bit bytes), if I writing only string like:

uint8_t data[] = "AA"

it is working great.

I need that every msg will be with some int counter.... and I'm getting an error.

uint8_t data[] = "AA" + String(msg_counter , DEC);

OR

uint8_t data[] =String(msg_counter , DEC);

Any help?
Thank you.

You can not concatenate like that; data is only three bytes in size; there is no space to append. Either make everything Strings (not such a nice idea) or use something like below.

// buffer to hold up 31 characters and terminating nul character
// adjust size to needs
char buffer[32];
sprintf(buffer, "AA %d", msg_counter);
Serial.println(buffer);

Do you really need it? Can’t that be sent in two pieces?

For the previous solution - sprintf() is flash memory hungry, to save about 1.5kB if that matters then probably better to have a local buffer, load into the buffer with itoa() and use strcat() to build the final c-string