Arduino Potentiometer - Need to Restart Processing Script for new Arduino Readings to be read

I would expect the potentiometer readings to be sent to the processing script in real time so new readings can be read. However, I have to re-start the processing script for it to see new values of the potieniometer.

Arduino Uno Projects Book
Project 14 - Tweak the Arduino Logo

//Processing Script import processing.serial.*;
Serial myPort;
PImage logo;
int bgcolor = 0;
void setup(){
colorMode(HSB, 255);
logo = loadImage("");
size(300, 300);
println("Avaliable serial ports:");
myPort = new Serial(this, Serial.list()[0], 9600);
void draw(){
if (myPort.available() > 0) {
bgcolor =;
background(bgcolor, 255, 255);
image(logo, 0, 0);

//Arduino Script
void setup() {
// initialize serial communication
void loop() {
// read the value of A0, divide by 4 and
// send it as a byte over the serial connection
Serial.write(analogRead(A0) / 4);

Sign In or Register to comment.