import processing.serial.*; int c = 0; // To store data from serial port, used to color background Serial port; String buf=""; int cr = 13; // ASCII return == 13 int lf = 10; // ASCII linefeed == 10 void setup() { size(200,200); println(Serial.list()); port = new Serial(this, Serial.list()[6], 9600); } void draw() { background(c); } // Called whenever there is something available to read void serialEvent(Serial port) { c = port.read(); /* this print statement will allow you to see whether or not Processing can "hear" anything that Arduino is sending. It should print all the changing values of the FSR or Photocell in your circuit If nothing is printing, you probably picked the wrong serial port. */ println(c); if (c != lf && c != cr) { buf += char(c); } if (c == lf) { c = int(buf); println("val="+c); int x = int(random(0,width)); int y = int(random(0,height)); buf = ""; } }