import processing.serial.*; Serial myPort; float x; int y; void setup() { background(255); size(800,500); myPort = new Serial(this,"COM5",9600); y = 0; } void draw() { x+=0.1; noStroke(); fill(#F7114F); //ellipse(x,400-3*y,10,10); ellipse(x,3.*y+100.,10,10); if(x>width){ x = 0; background(255); } } void serialEvent(Serial myPort){ y = myPort.read(); }