Unable to receive serial data from Arduino

You are receiving what you are sending:

val = 255;
Serial.print(val);

Will send ASCI characters 50, 53, 53 for 2, 5, 5, and that is what you are seeing.

https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html

Try:

val = 255;
Serial.write(val);

And Processing will receive:

Also, you will not be able to send greater than 255 with this example since you are sending bytes and the int will be cast to a byte.
Try the code with the val++ and you will see this.
I will leave that as an exercise for further exploration.

:slight_smile:

2 Likes