We are about to switch to a new forum software. Until then we have removed the registration on this forum.
The Most strange thing I have found in Processing is the range of the Byte type: -127 to 127. Why?? Normally, also in Arduino, Byte is a number between 0 and 255.
For example I want to send the byte 250 (in decimal) through a serial port.
Show me on this simple code the trick:
byte mybyte = ???; myport.write(mybyte);
Answers
byte
is -128 to 127 range!unsigned char
datatype instead of Java'sbyte
, which issigned
.unsigned char
250 becomesbyte
-6:println((byte) 250);
http://docs.Oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
Because all numerical types in Java (except char, which is only "half" a numerical type) are signed. An unfortunate choice, but we have to live with it.