import processing.serial.*; byte serByte = 0; float r=0; Serial port; void setup() { size(255, 255); background(0); println(Serial.list()); port = new Serial(this, Serial.list()[3], 9600); } void draw() { for(int i=0; i<255; i++) { r = random(255); stroke(r*5, r*5); line(0, i, 0+r, i); serByte = byte(r); //convert float to byte, int from -128 to 127 port.write(serByte); println(serByte); } }