arduino code for the buttons.
void loop() {
if (Serial.available()> 0){
char val = Serial.read();
if(val== '1') {
shuttleruntest();
}
else if(val== '2') {
ledsAan();
display.setSegments(done);
}
}
}
processing code.
import controlP5.*;
import processing.serial.*;
ControlP5 controlP5;
Serial port;
void setup() {
printArray(Serial.list());
port = new Serial(this, "COM3", 9600);
size(700, 1000);
background(0, 225, 255);
controlP5 = new ControlP5(this);
controlP5.addButton("START")
.setValue(1)
.setPosition(300,300)
.setSize(100, 30)
.setColorBackground(0xffaa0000)
.setColorActive(0xff660000);
controlP5.addButton("STOP")
.setValue(1)
.setPosition(300,400)
.setSize(100, 30)
.setColorBackground(0xffaa0000)
.setColorActive(0xff660000);
}
void draw() {
fill(255, 255, 255);
rect(175, 100, 350, 800);
textSize(50);
fill(255, 0, 0);
text("Pacer15", 255, 200);
}
void START() {
port.write('1');
}
void STOP() {
port.write('2');
}