Sending bytes to serial port
Posted: Mon Apr 04, 2016 9:19 am
I need to be able to send out a serial sequence of byte values (preferably as hex if possible).
Say I need to send a hex value of 0D for instance.
I don't know if there is a print format that allows sending in hex, so I just tried sending the decimal equivalent instead (serialprintln 13).
But it appears to the serial monitor as the ascii representation of the number, rather than the actual value 13, which should be seen as a carraige return.
I also tried assigning the required value to a numeric variable (let var1 = 13) and sending the variable, but it still sends the ascii representation instead of the numeric value.
So is it possible to send a byte value to the serial port?
Say I need to send a hex value of 0D for instance.
I don't know if there is a print format that allows sending in hex, so I just tried sending the decimal equivalent instead (serialprintln 13).
But it appears to the serial monitor as the ascii representation of the number, rather than the actual value 13, which should be seen as a carraige return.
I also tried assigning the required value to a numeric variable (let var1 = 13) and sending the variable, but it still sends the ascii representation instead of the numeric value.
So is it possible to send a byte value to the serial port?