import controlP5.*; // Import ControlP5 library import processing.serial.*; Serial port; ControlP5 cp5; // Cretae ControlP5 object PFont font; // Control button font style void setup(){ size(300,400); // window size (width, height) printArray(Serial.list()); // Prints all available serial ports port = new Serial(this, "COM3", 9600); // Add buttons cp5 = new ControlP5(this); font = createFont("calibri light bold", 20); // custom fonts for buttons and title cp5.addButton("Red") // "0 deg" is the name of button .setPosition(100, 80) // x- and y- coordinates of upper left corner of button .setSize(100, 80) // (width, height) .setFont(font) ; cp5.addButton("Green") // "45 deg" is the name of button .setPosition(100, 180) // x- and y- coordinates of upper left corner of button .setSize(100, 80) // (width, height) .setFont(font) ; cp5.addButton("Blue") // "90 deg" is the name of button .setPosition(100, 280) // x- and y- coordinates of upper left corner of button .setSize(100, 80) // (width, height) .setFont(font) ; } void draw(){ // same as loop in arduino background(150, 150, 150); // background color of window (r, g, b) (0 to 255) // Title fill(255, 255, 0); // text color (r, g, b) textFont(font); text("LED CONTROL",75,30); // ("Text", x-coord, y-coord) } // Lets add some functions to our buttons void Red(){ port.write('r'); } void Green(){ port.write('g'); } void Blue(){ port.write('b'); }