Created
February 14, 2013 02:50
-
-
Save joshuajnoble/4950235 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
//Processing | |
dev.write('x'); | |
dev.write(r, INT); | |
dev.write(g, INT); | |
dev.write(b, INT); | |
//Arduino | |
if (Serial.available()) { // If data is available to read, | |
val = Serial.read(); // read it and store it in val | |
if (val == 'x') { //If start char is recieved, | |
while (!Serial.available()) {} //Wait until next value. | |
r = Serial.read(); //Once available, assign. | |
while (!Serial.available()) {} //Same as above. | |
g = Serial.read(); | |
while (!Serial.available()) {} | |
b = Serial.read(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment