Projet

Général

Profil

Task #13251 » sketch_200716a.pde

Code Processing - Anonyme, 07/10/2021 13:20

 
import processing.serial.*;
import controlP5.*;

Serial port;
ControlP5 cp5;
PFont font;

void setup(){
size (300, 200);
printArray(Serial.list());
port = new Serial(this, Serial.list()[1], 9600);
cp5 = new ControlP5(this);
font = createFont("Arial", 18);
cp5.addButton("ON")
.setPosition(40, 50)
.setSize(100,50)
;
cp5.addButton("OFF")
.setPosition(160, 50)
.setSize(100,50)
;
cp5.addButton("Blink")
.setPosition(100, 120)
.setSize(100,50)
;
}

void draw(){
background (160, 0, 150);

fill(0, 210, 190);
textFont(font);
text("LED CONTROL", 90, 30);
}

void ON(){
port.write("O");
}

void OFF(){
port.write("I");
}

void Blink(){
port.write("B");
}
(3-3/3)