import processing.serial.*; Serial myPort; String portAddress="/dev/ttyUSB1"; void setup(){ size(660,380); background(0); noFill(); myPort = new Serial(this, portAddress, 9600); } void draw(){ size(660,380); background(0); noFill(); while (myPort.available() > 0){ char inByte = myPort.readChar(); if(inByte == 'd'){ stroke(255,0,0); fill(255,0,0); ellipse(200,200,30,30); } else if(inByte == 'u'){ stroke(162,211,172); fill(162,211,172); ellipse(450,200,30,30); } } }