Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (25 sloc) 685 Bytes
void serialEvent (Serial myPort) {
String inputString = myPort.readStringUntil('\n');
if (inputString != null) {
inputString = trim(inputString);
if (firstContact == false) {
if (inputString.equals("A")) {
myPort.clear();
firstContact = true;
myPort.write("A");
}
} else {
int values[] = int(split(inputString, ','));
for (int valueNum = 0; valueNum < values.length; valueNum++) {
print("values" + valueNum + ":" + values[valueNum] + "\t");
}
println();
if (values.length > 2) {
red=values[0];
green=values[1];
blue=values[2];
}
}
myPort.write("A");
}
}