Hi,
i'm doing project using TCS34725 to detect RGB color from flame. But I did not quite understand the relation between integration time, gain and the output. The code i'm using is : Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); and Uint_16.
The result that i get now is more than 255 for R, G, B color. How I convert the output into 0 - 255 scale?
Thanks
Output Readings
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88088
- Joined: Sat Feb 07, 2009 10:11 am
Re: Output Readings
It is a 16 bit sensor, so the R, G, B values are in the range of 0-65535. If you want to convert to 8-bit low-res RGB, you need to discard the lower 8-bits. You can do that by simply dividing R, G and B readings by 256.
- verisca
- Posts: 3
- Joined: Wed Jul 25, 2018 12:43 pm
Re: Output Readings
Thanks a lot, it helps.
I also have anotherquestion. I choose to use Uint_16_t because I see it in this link
https://learn.adafruit.com/adafruit-col ... -reference
can you explain why it suggest to use Uint_16 instead of Uint_8?
And I cannot get the 65535 value at the max when I used white light on the RGB sensor. Is it related with the integration time and gain I used?
I also have anotherquestion. I choose to use Uint_16_t because I see it in this link
https://learn.adafruit.com/adafruit-col ... -reference
can you explain why it suggest to use Uint_16 instead of Uint_8?
And I cannot get the 65535 value at the max when I used white light on the RGB sensor. Is it related with the integration time and gain I used?
- adafruit_support_bill
- Posts: 88088
- Joined: Sat Feb 07, 2009 10:11 am
Re: Output Readings
Because it is a high-resolution sensor and returns 16-bit values for R, G, B and C.can you explain why it suggest to use Uint_16 instead of Uint_8?
Yes. Increasing the gain and/or integration time will result in higher value readings.And I cannot get the 65535 value at the max when I used white light on the RGB sensor. Is it related with the integration time and gain I used?
Please be positive and constructive with your questions and comments.