Skip to content

Instantly share code, notes, and snippets.

@joshuajnoble
Created February 14, 2013 02:50
Show Gist options
  • Save joshuajnoble/4950235 to your computer and use it in GitHub Desktop.
Save joshuajnoble/4950235 to your computer and use it in GitHub Desktop.
//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