Seems you have to run these serially, but not sure why it's an issue, a due is quick.
seems more programming related... 'detectColor' is a function, and this is run inside the loop i assume.
int taosOutPin1 = 10; //color detector 1
int taosOutPin2 = 2; //Pins are examples, change to actual pin...
int taosOutPin3 = 3;
int taosOutPin4 = 4; //color detector 4
typedef struct {
float white;
float red;
float blue;
float green;
} color;
void setup() {
// put your setup code here, to run once:
}
void loop() {
color detectedColorForSensor1 = detectColor(taosOutPin1);
color detectedColorForSensor2 = detectColor(taosOutPin2);
color detectedColorForSensor3 = detectColor(taosOutPin3);
color detectedColorForSensor4 = detectColor(taosOutPin4);
Serial.print(detectedColorForSensor1.red);
Serial.print(detectedColorForSensor1.green);
Serial.print(detectedColorForSensor1.blue);
Serial.print(detectedColorForSensor1.white);
//etc for sensor 2,3,4............
}
color detectColor(int taosOutPin1) {
color detectedColor;
detectedColor.white = colorRead(taosOutPin1,0,1);
detectedColor.red = colorRead(taosOutPin1,1,1);
detectedColor.blue = colorRead(taosOutPin1,2,1);
detectedColor.green = colorRead(taosOutPin1,3,1);
return detectedColor;
}