I am trying to write a byte of value 160 over a serial connection, to a Java application.
byte id = 128;
Serial.write( id);
Anything up to a value of 127 works fine, otherwise the byte is received as 65533, which I understand means invalid character.
The arduino spec says that a byte is "an 8-bit unsigned number, from 0 to 255" so not sure why this isn't working.
Here's the Java code and output,
int id = input.read();
LOG.info("id " + id);
"INFO: id 65533"
The Java spec says of this method "The character read, as an integer in the range 0 to 65535", so what am I doing wrong?