Potentiometer with Processing does not update value [images included]

Hi all,

I am trying to transmit a value using a potentiometer to Processing but there seems to be something wrong. It takes almost 10 seconds for Processing to update and then it only does so half the time, at a very jerky transition.

Many thanks

I can't see anything wrong here.
You are writing a character to your serial port, and that character is supposed to be an 8 bit value.
The character is followed by the actually read value.
But the result of your measurement is a 10 bit value.
The first result is ASCII character 255, which is correct for a ten bit value with all ones (= 1023).
You should find out about mapping your analog read to a 8 bit value.
Then the values will be more to what you'd expect (i think).

ok cool. Thanks for clarifying that.

I've updated the question to reflect the other issue I am having.

I found the solution in this post:
http://forum.arduino.cc/index.php?topic=174739.msg1298593#msg1298593

The delay needs to be higher.

Please don't modify your threads like this next time.
You have started a thread about one issue, and when that issue has been addressed, you change the thread to something completely different and unrelated.
That is including a complete new first question and pictures.
Now someone (me) is answering a question you never seem to have asked, and the thread becomes very confusing.

Next time append your new issue to the first one, or start a new thread please.

You only read one byte each time draw() is called, and it probably isn't called very often. If you replace that 'if' with a 'while' then it would consume all available serial input each time draw() was called. That might still mean there is some latency while you want for draw() to be called, but it would avoid having that potentially large backlog of unread serial input pending in the serial buffer that you have to wade through before you reach the updated data.

If you replace that 'if' with a 'while' then it would consume all available serial input each time draw() was called. That might still mean there is some latency while you want for draw() to be called

Which is exactly why serial input should NOT happen in draw().

There is a bufferUntil() method, and a serialEvent() callback, that you can use to do serial input outside of draw() (where it belongs).