I have a pot hooked up to my Arduino sending the value over serial to my computer. In the Arduino serial monitor the values come back the way they are supposed to, but when I do serial.read() in processing the values jump between random values, even when Im not moving the pot. Even when I do move the pot it still jumps between the same random values. Am I doing something wrong in processing? I basically have it set up like val=port.read(); println(val); If anyone has any ideas to what Im doing wrong, let me know. Thanks.
Have you had a look at this potentiometer + arduino + processing tutorial? http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/poti.html
The framerate() function was renamed frameRate() recently. Other than that the downloadable code should still work.
I think the problem is that you're sending from Arduino a string of digits - e.g. 123 would be sent as the three bytes '1', '2', '3' (which have ASCII values of 49, 50, and 51) - but reading in Processing only a byte at a time. What you need to do is read the incoming bytes as characters in Processing, collect them until you reach a newline or carriage return and then convert the accumulated string to an integer. The link neillzero mentioned has some code for this.