TCS3200 Color Sensor

hi everybody

i find a sample for TCS3200 Color Sensor

but cant use

the error is

int readOutputPulse(int pin) {
int count = 0;
while ((digitalRead(pin) == 1) & (count < 32640)) {
count ;
}
If (count == 32640) return count 2;
count = 0; While ((digitalRead(pin) == 0) & (count < 32640)) {
count ;
}
return count;
}

error: 'If' was not declared in this scope

can tell me how to fix it?

thanks!

int s2Pin = 7;
int s3Pin = 8;
int outPin = 4;

void setup() {
pinMode(s2Pin, OUTPUT);
pinMode(s3Pin, OUTPUT);
pinMode(outPin, INPUT);
Serial.begin(9600);
}

int readOutputPulse(int pin) {
int count = 0;
while ((digitalRead(pin) == 1) & (count < 32640)) {
count ;
}
If (count == 32640) return count 2;
count = 0; While ((digitalRead(pin) == 0) & (count < 32640)) {
count ;
}
return count;
}

int readRed() {
int pulseWidth = 0;
int colorStrength = 0;
digitalWrite(s2Pin, LOW);
digitalWrite(s3Pin, LOW);
delay(100);
pulsewidth = readOutputPulse(outPin);
colorStrength = (pulsewidth/128);
colorStrength = (255 - colorStrength);
return colorStrength;
}

int readGreen() {
int pulseWidth = 0;
int colorStrength = 0;
digitalWrite(s2Pin, HIGH);
digitalWrite(s3Pin, HIGH);
delay(100);
pulsewidth = readOutputPulse(outPin);
colorStrength = (pulsewidth/128);
colorStrength = (255 - colorStrength);
return colorStrength;
}

int readBlue() {
int pulseWidth = 0;
int colorStrength = 0;
digitalWrite(s2Pin, LOW);
digitalWrite(s3Pin, HIGH);
delay(100);
pulsewidth = readOutputPulse(outPin);
colorStrength = (pulsewidth/128);
colorStrength = (256 - colorStrength);
return colorStrength;
}

void loop() {
Serial .print("R:");
Out.println serial(readRed());
Serial .print("G:");
Out.println serial(readGreen());
Serial .print("(B):");
Out.println serial(readBlue());
Out.println serial("");
delay(500);
}

"If" and "if" is not the same for a computer. You have to write statement exactly the way they are defined. Changing the case of one character provides a syntax error in best case.