Store the bytes in an array, add a '\0' (nul terminator) and print. Something like below
byte data[] = {65, 114, 100, 117, 105, 110, 111};
void setup()
{
Serial.begin(57600);
// text buffer
char text[sizeof(data) + 1];
// clear if (fill with nul terminators)
memset(text, '\0', sizeof(text));
// copy data to text
memcpy(text, data, sizeof(data));
// print it
Serial.println(text);
}
void loop()
{
// put your main code here, to run repeatedly:
}
akash614:
i had to remove the operator + and trim to get the right result
Thank You it helped me a lot
thanks again
You shouldn't. You need one byte more for a terminating nul character in the text. You can't print a text (c-ctring) without a terminating nul; you are lucky it works but it is wrong without it.
sterretje:
You shouldn't. You need one byte more for a terminating nul character in the text. You can't print a text (c-ctring) without a terminating nul; you are lucky it works but it is wrong without it.
i had made few changes to the code and it works flawless and meets my requirement so thanks all of you guys for responding to this topic