Serial write char larger than 127

Thank you for reading this.

I’ve been playing with the g4p text box and the knob to send serial data to an Arduino but have run into a problem with char values larger than 127. Is there another method to serial write int values? I know that 170 is beyond what a char value can be.

This what I’m doing:

  int my_value = knob1.getValueI();
    
  myPort.write(char(my_value)); 

In this case the int my_value can be between 10 and 170.

1 Like

i told you in your last question:

what i want to say is stay on the ( easy diagnostic ) ASCII level
until there is no other way as to write byte stream / own protocol …

means:

write a arduino program where you
also from the arduino IDE monitor can send type
multi character ASCII TEXT in a LINE (CR LF )

 1000

and the arduino catch that whole String and makes a number again out of it.


if stay on one byte / character level will be ever restricted to that understanding
and that is different processing and Arduino…
run:

  println( "byte     "+Byte.SIZE+  " bit | min: "+Byte.MIN_VALUE+   "\t\t\t max: "+Byte.MAX_VALUE);
1 Like

Possibly a relevant Arduino + Processing example – the final post on this thread:

Serial write of byte > 127