import controlP5.*; import processing.serial.*; Serial port; ControlP5 cp5; PFont font; void setup (){ size(400, 400); printArray(Serial.list()); port = new Serial(this, "COM26", 9600); cp5 = new ControlP5(this); font = createFont("calibri light bold", 13); cp5.addButton("LED") .setPosition(85,50) .setSize(100,80) .setFont(font) ; cp5.addButton("alloff") .setPosition(210,50) .setSize(100,80) .setFont(font) ; } void draw () { background(128); fill(0,255,0); textSize(15); textAlign(CENTER); text("SERVO & LED CONTROL", 200, 30); int servoAngle = (int) 255 * mouseX/width; String degree = servoAngle+"°"; textSize(42); textAlign(CENTER); text(degree, 400/2, 400/2); port.write(servoAngle); } //void lED() { // port.write('r'); //} //void alloff() { // port.write('f'); //}