Stuck with SIZE command

Hello guys.
I am trying to control my servo with Processing. And it actually works.
But I wanted to fool around with the code a bit to get a grip off it, and I started changing a tutorial code a bit.
And I ran into a wall which I can not figure out.

Originally window size is (256x150) and I have tryed to change it. When I expanded or shrunk the Y axis, it was all good.
But when I expanded the X axis the problems occurred whether I was shrunk it or expanded it. It gave me a border inside the window, and when I crossed it with mouse, the servo jumped back to 0 position, telling me that it mouseX read a 0 again, though I haven’t reached the end of my window.

This is my code:

I have altered my Arduino code, and it works OK. It seems that I ran into some sort of boundary in Processing.
Anyone knows what I did wrong?

Picture depicts, how my window looks like.

1 Like

The problem has got to be something related to the fact that you are using a single byte to communicate. With one byte, the values that byte can represent range from 0 (0x00000000) to 255 (0x111111111). If you try to store more than 255 in a byte, it wraps around, back to 0, because it can only copy the lowest 8 bits!


@TfGuy44 thank you for your reply. I was so excited about your anser that I tried it immediately.
I have done the following:

and also:

so I have made it an integer. Still, I face the same problem. :sweat:

1 Like


You should be able to write ints.

Can we see your full code?

there it is:

on the arduino side I have also turned all variables into integers.
@TfGuy44 - Thanks man!

1 Like