Why is my data converted to ASCII using Serial.print function??

HEllo all,

I am coding a small software to send data with an RN2483 transciever, and I have realised that my data is converted to ASCII when I sent it through serial. It is to say, I have the following part in the sender, the data has to be HEX

String aux = String(message.charAt(i),HEX);
dataToBeTx = "radio tx " + aux+ "\r\n";

On the receiver I am reading Serial1 till I get the message, which I receive properly, however it is an ASCII representation of the HEX data, and I would like to have it HEX, I mean, I send HI that is converted to HEX (H I=>0x48 0x49) on the receiver if I translate that value to HEX again I got different things than my H or I , so I guess it is being encoded in ASCII, how can I ride off from that?

Thanks in advance,


That's the whole idea of the print function... Also, you tell the (stupid) String class to make it hex.

Skip the string and try:

Serial1.print("radio tx ");

Can also subtract 0x30, or 48 decimal, from the data as it comes in to convert it from ASCII to Hex
'0' = 0x30, -0x30 = 0