Created
July 2, 2016 01:26
-
-
Save taesamja/969817dad14642b7b5c4845f2164d168 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
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