Created
July 2, 2016 01:26
-
-
Save taesamja/55711a742f61c3956f6a26f1abe0a0af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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