Go Down

Topic: HDJD-S822 Color Sensor Code? (Read 4 times) previous topic - next topic

PaulS

Quote
what should i do to make it better?

Now, we know what sensor you are using, but not how you have connected it to the Arduino. Feel free to volunteer any other info we might need, too.

zhirantaha

i just connected by jumber wire and breadboard

PaulS

Quote
i just connected by jumber wire and breadboard

Well, that's certainly enough detail to be sure that you wired it correctly. The only other thing I can think of then is that maybe you should have used duct tape.

PeterH

You could just check for the red, green and blue intensities being similar to the figures you get from the paper samples.

For example:
Code: [Select]

if((red < 150) && (green > 100) && (green < 200) && (blue > 200))
{
  Serial.println("Red");
}


The RGB values you describe don't seem to correspond to the colour of the paper that you say produced them so you probably have your sensor wired incorrectly or the channels swapped over, but since you seem to be getting consistent values for a given colour you can use those to tell when that colour is present.
I only provide help via the forum - please do not contact me for private consultancy.

zhirantaha

thanks for all replay but i have a question about the range
does anyone know more about this sensor technically??

Go Up