import processing.serial.*; Serial myPort; // Create object from Serial class int tmp,inByte; void setup() { size(640,480,P3D); //make our canvas 200 x 200 pixels big String portName = Serial.list()[0]; //change the 0 to a 1 or 2 etc. to match your port myPort = new Serial(this, portName, 9600); } void draw() { while (myPort.available() > 0) { inByte = myPort.read(); } lights(); translate(320,240); background(0,255,24); float rotx=float(inByte)/100; println(rotx); rotateX(rotx); rotateY(0.5); box(100); }