Hello,
I've tried to solve the next problem by my own looking for similar topics in this forum, but I did not get succes. From the serial port I will get a string that represents an HEX value, like this:

(I guess that the data will apear on the serial monitor without space, like"54472c3031...")
If I take this string and write it in an ASCII converter I get this:

What should I do to get a String with EXACTLY what is indicated in the last picture?
I've read many many many topics trying to find a solution, but couldnt find it.
I think that I've detailed EXACTLY what I want, but I will re-explain myself again if necessary!
Thanks!!
The two images contain the same data, the only difference is how it is displayed.
char message[] = "TG,01,+000.000";
Serial.println(message);
for (int i = 0; i < sizeof(message); i++)
{
Serial.print((int)message[i], HEX);
Serial.print(" ");
}
Serial.println();
The message is a string with hex numbers though
If you get an ascii-string which contains hex-values, you can find an answer here. The number of bytes is half of the hex-string's length int num_bytes = strlen(hex_string) / 2.
Yes, but I need to read the serial port (with serial.read()) to get the string of the first image. After that I want to get the string of the second image. The string will change continually because it comes from a sensor.
How can I do it?
Thanks, but I don't understand what is said on the link you provided (Im new on programming)... Could you explain, please?
From the serial port you get binary values. The binary values can be displayed in human readable hex representation, but may also be printable ASCII representations of text and numbers.
It appears that in your case the binary values are ASCII, so just print the string. For advance on how to do that, post the code you are using to read the serial port, using code tags ("</>" editor button).
Hi
is it the same subject?
" Cadena HEX a cadena ASCII "