School project: LF Help with Color Sensor i2c

Hello everyone ! I am a young french student, and i need help for my school project! I need a program to read an RGB code and to turn on a LED if these RGB code are detected: 100 255 50(red) 255 0 50(green) 255 100 255(pink). I didnt find the connections too, i want to link it to a base shield v1.3. I didnt find anything on Google. I have no idea where to connect "SDA" and "SCL" wires.Thanks to help me as soon as possible. Here is the beginning of my program:

void loop() { GroveColorSensor colorSensor; color.ledStatus = 1; while(1) { colorSensor.readRGB(&red, &green, &blue); //Lit les valeurs RGB delay(300) if(red =100 && green = 255 && blue = 50) { digitalWrite(led, HIGH) delay(1000) digitalWrite(led, LOW) } }

}

Did you see the French section of the forum?

Please enclose code in Code Tags </>, as shown below.

Have a look at the data sheet of your board or shield, where the SCL and SCA lines for the I2C bus are exposed.

In your code move the declaration

 GroveColorSensor colorSensor;

out of loop(), before setup().

 if(red =100 && green = 255 && blue = 50)

use "==" and keep in mind that the values output by the sensor will [u]almost never be exactly those values[/u].

Thanks you DrDiettrich for the help.
And, jremington, If values arn’t exact, how can i make a range of values ?
Instead of “if(red =100 &&…)”, “if(red >90 && red <110…)” ? Is it good ?
Thanks you for the reply too.

Yes, that's the idea.

Victorsin: I have no idea where to connect "SDA" and "SCL" wires.

SDA and SCL are the I2C lines. Google Arduino and I2C and you should see where to hook them. If it doesn't make sense right away then google I2C and learn what that means.