Skip to content

Instantly share code, notes, and snippets.

@taesamja
Created July 2, 2016 01:26
Show Gist options
  • Save taesamja/55711a742f61c3956f6a26f1abe0a0af to your computer and use it in GitHub Desktop.
Save taesamja/55711a742f61c3956f6a26f1abe0a0af to your computer and use it in GitHub Desktop.
import processing.serial.*;
Serial port;
PImage img;
void setup() {
port = new Serial(this,Serial.list()[0],9600);
size(800,600);
img = loadImage("color.png");
image(img,0,0,width,height);
}
void draw() {
color sample = get(mouseX,mouseY);
//Red, Green, Blue
int R = int(red(sample));
int G = int(green(sample));
int B = int(blue(sample));
port.write(R + " " + G + " " + B + "\n");
print(R);print(" ");print(G);print(" ");print(B);print(" ");
println();
delay(20);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment