const int sio =2; // ColorPAL connected to pin 2
const int unused = 255; // Non-existant pin # for SoftwareSerial
const int sioBaud = 4800;
const int waitDelay =200;
const int sio2 = 3; // ColorPAL connected to pin 2
const int unused2 = 255; // Non-existant pin # for SoftwareSerial
const int sioBaud2 = 7200;
const int waitDelay2 =200;
// Received RGB values from ColorPAL
int red;
int grn;
int blu;
int red2;
int grn2;
int blu2;
// Set up two software serials on the same pin.
SoftwareSerial serin(sio, unused);
SoftwareSerial serout(unused, sio);
if (serin.available() > 0) {
// Wait for a $ character, then read three 3 digit hex numbers
buffer[0] = serin.read();
if (buffer[0] == '$') {
for(int i = 0; i < 9; i++) {
while (serin.available() == 0); // Wait for next input character
buffer[i] = serin.read();
if (buffer[i] == '$') // Return early if $ character encountered
return;
}
parseAndPrint(buffer);
delay(10);
}
}
}