TCS 3200 color sensor

Ciao a tutti! ho comprato un TCS3200 color sensor, ho scaricato uno Sketch di esempio per vedere come lavora ma non c'è verso di farlo funzionare... sulla seriale, per un tratto vedo qualche scritta indicante il colore e un punteggio poi parte una riga orizzontale di caratteri strani.. come se andassi fuori range. Non conosco questo sensore e volevo provare il funzionamento.

int S0 = 10; //You can simply connect this pin to ground in this example
int S1 = 9; //You can simply connect this pin to 5V in this example

int taosOutPin = 2; //Pin 2
int S2 = 7; //Pin 7
int S3 =8; //Pin 8

void setup() {
TCS3200setup();
Serial.begin(115200);
delay(100);
}

void loop() {
// primary loop takes color readings from all four channels and displays the raw values once per second.

detectColor(taosOutPin);
//Serial.print("nnn");
delay(200);

}

int detectColor(int taosOutPin){

int white = colorRead(taosOutPin,0,1);
int red = colorRead(taosOutPin,1,1);
int blue = colorRead(taosOutPin,2,1);
int green = colorRead(taosOutPin,3,1);

//Serial.print("white ");
Serial.print(white);
//Serial.print("red ");
Serial.print(",");
Serial.print(red);

//Serial.print("blue ");
Serial.print(",");
Serial.print(blue);
//Serial.print("green ");
Serial.print(",");
Serial.println(green);

}

/*
This section will return the pulseIn reading of the selected color.
It will turn on the sensor at the start taosMode(1), and it will power off the sensor at the end taosMode(0)
color codes: 0=white, 1=red, 2=blue, 3=green
taosOutPin is the ouput pin of the TCS3200.
*/

int colorRead(int taosOutPin, int color, boolean LEDstate){

//turn on sensor and use highest frequency/sensitivity setting
taosMode(3);

//setting for a delay to let the sensor sit for a moment before taking a reading.
int sensorDelay = 5;

//set the S2 and S3 pins to select the color to be sensed
if(color == 0){//white
digitalWrite(S3, LOW); //S3
digitalWrite(S2, HIGH); //S2
// Serial.print(" w");
}

else if(color == 1){//red
digitalWrite(S3, LOW); //S3
digitalWrite(S2, LOW); //S2
// Serial.print(" r");
}

else if(color == 2){//blue
digitalWrite(S3, HIGH); //S3
digitalWrite(S2, LOW); //S2
// Serial.print(" b");
}

else if(color == 3){//green
digitalWrite(S3, HIGH); //S3
digitalWrite(S2, HIGH); //S2
// Serial.print(" g");
}

// create a var where the pulse reading from sensor will go
unsigned int readPulse;

// this portion of the code is still in development, but is not needed atm
// turn LEDs on or off, as directed by the LEDstate var
//if(LEDstate == 0){
// digitalWrite(LED, LOW);
//}
//if(LEDstate == 1){
// digitalWrite(LED, HIGH);
//}

// wait a bit for LEDs to actually turn on, as directed by sensorDelay var
delay(sensorDelay);

// now take a measurement from the sensor, timing a low pulse on the sensor's "out" pin
readPulse = pulseIn(taosOutPin, LOW);

//turn off color sensor and LEDs to save power
//taosMode(0);

// return the pulse value back to whatever called for it...

if(readPulse > 102400 || readPulse == 0) readPulse=102400;
readPulse=readPulse/100;
readPulse = 1024 - readPulse;
readPulse = readPulse/4 - 1;
return readPulse;

}

// Operation modes area, controlled by hi/lo settings on S0 and S1 pins.
//setting mode to zero will put taos into low power mode. taosMode(0);

void taosMode(int mode){

if(mode == 0){
//power OFF mode- LED off and both channels "low"
//digitalWrite(LED, LOW);
digitalWrite(S0, LOW); //S0
digitalWrite(S1, LOW); //S1
// Serial.println("mOFFm");

}else if(mode == 1){
//this will put in 1:1, highest sensitivity
digitalWrite(S0, HIGH); //S0
digitalWrite(S1, HIGH); //S1
// Serial.println("m1:1m");

}else if(mode == 2){
//this will put in 1:5
digitalWrite(S0, HIGH); //S0
digitalWrite(S1, LOW); //S1
//Serial.println("m1:5m");

}else if(mode == 3){
//this will put in 1:50
digitalWrite(S0, LOW); //S0
digitalWrite(S1, HIGH); //S1
//Serial.println("m1:50m");
}

return;

}

void TCS3200setup(){

//initialize pins
//pinMode(LED,OUTPUT); //LED pinD

//color mode selection
pinMode(S2,OUTPUT); //S2 pinE
pinMode(S3,OUTPUT); //s3 pinF

//color response pin (only actual input from taos)
pinMode(taosOutPin, INPUT); //taosOutPin pinC

//communication freq (sensitivity) selection
pinMode(S0,OUTPUT); //S0 pinB
pinMode(S1,OUTPUT); //S1 pinA

return;

}

vi ringrazio per la disponibilità

Nessunopuò darmi qualche dritta?!