// modeled off code by Tom Igoe
import processing.serial.*;
Serial myPort;
void setup() {
myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
}
void serialEvent(Serial myPort) {
int inChar = myPort.read();
// filter out CR and NL
if (inChar != 13 && inChar != 10) {
println(hex(inChar, 2) + " : " + char(inChar));
}
}
void keyReleased() {
switch (key) {
case 'a':
myPort.write(key);
println("a");
break;
case 'b':
myPort.write(key);
println("b");
break;
case 'l':
myPort.write(key);
println("l");
break;
case 'L':
myPort.write(key);
myPort.write(128);
println("L");
break;
case 'S':
myPort.write(key);
myPort.write(50);
println("S");
break;
case 's':
myPort.write(key);
println("s");
break;
}
}