import processing.serial.*;
Serial port;
int sData = 0;
void setup() {
size(255, 255);
port = new Serial(this, "/dev/cu.usbmodem141011", 115200);
}
void draw() {
background(255);
println(sData);
}
void serialEvent(Serial port) {
String str = port.readStringUntil('\n');
if(str != null) {
String s = trim(str);
sData = int(s);
}
}