Browse Source

add keys in processing

develop
Leandro Estrella rPi 6 years ago
parent
commit
49170f86e2
  1. 16
      ephimera/ephimera.pde
  2. 3
      ephimera/serial.pde

16
ephimera/ephimera.pde

@ -57,6 +57,7 @@ void draw() {
} }
void keyPressed() { void keyPressed() {
println(int(key));
if (key == 'S' || key == 's') { if (key == 'S' || key == 's') {
video.pause(); video.pause();
makePicture(); makePicture();
@ -67,4 +68,19 @@ void keyPressed() {
if (key == 'G' || key == 'g') { if (key == 'G' || key == 'g') {
video.start(); video.start();
} }
if (key == 'U' || key == 'u') {
sendMessage(C_TAG, colorByteValues);
}
if (key == '1' || key == '2' || key == 3 || key == 4 || key == 5 || key == 6 || key == 7 || key == 8) {
for(int i = 0; i<colorsN; i++) {
colorByteValues[i] = (int(key)-49) == i ? byte(100) : 0;
print(colorByteValues[i] + "\t");
}
println("");
sendMessage(B_TAG, colorByteValues);
}
} }

3
ephimera/serial.pde

@ -1,6 +1,7 @@
public static final char HEADER = 'H'; public static final char HEADER = 'H';
public static final char A_TAG = 'M'; public static final char A_TAG = 'M';
public static final char B_TAG = 'X'; public static final char B_TAG = 'X';
public static final char C_TAG = 'U';
void ephSerial() { void ephSerial() {
@ -31,4 +32,4 @@ void serialEvent(Serial p) {
if(inString != null) { if(inString != null) {
print( inString ); // echo text string from Arduino print( inString ); // echo text string from Arduino
} }
}
}
Loading…
Cancel
Save