Skip to content

Instantly share code, notes, and snippets.

@taesamja
Created July 2, 2016 01:26
Show Gist options
  • Save taesamja/969817dad14642b7b5c4845f2164d168 to your computer and use it in GitHub Desktop.
Save taesamja/969817dad14642b7b5c4845f2164d168 to your computer and use it in GitHub Desktop.
int R = 11;
int G = 10;
int B = 9;
void setup() {
pinMode(R,OUTPUT);
pinMode(G,OUTPUT);
pinMode(B,OUTPUT);
Serial.begin(9600);
}
void loop() {
while (Serial.available()) {
int red = Serial.parseInt();
int green = Serial.parseInt();
int blue = Serial.parseInt();
if (Serial.read() == '\n') {
analogWrite(R,red);
analogWrite(G,green);
analogWrite(B,blue);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment