Processing and Arduino - String to bytes

maurobarreca:
There's no problem reducing the resolution, I don't think people can notice by eye the difference between 4095 brightness values and 2620 (I think that's the new resolution). It is still much better than 255 values.

I did not know that is what you had in mind by reduced resolution. With my system there will be no reduction in the resolution of the data. You can send 4095 just as easily as 2620. 4095 will encode into two bytes with the value 63 and 63. 2620 will encode as 40 and 60. (Note that all my numbers are in decimal).

You would then add 48 to bring the byte values into the range of convenient printable characters - so that 2620 is transmitted as 88 and 108 which is 'X' 'l'. (The second character is lower-case L)

If you need to send a value bigger than 4095 it would have to be encoded into 3 bytes.

...R