astro-pi / python-sense-hat

Source code for Sense HAT Python library
https://sense-hat.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
505 stars 253 forks source link

TCS34725 and TCS3400 support #131

Closed tvoverbeek closed 11 months ago

tvoverbeek commented 1 year ago

Detects the used sensor. so the same code supports both. TCS3400 is used for the Sense Hat V2 while the (discontinued) TCS34725 is used on the AstroPi sense hat for the ISS.

Also included a bug fix for the computation of the red_raw, green_raw, blue_raw and clear_raw values. The original code ony fetched the LSB, not the complete 16-bit value.

See also issue #126

G3zz commented 1 year ago

Thanks very much for this - I need to acquire a sense hat with the TCS3400 so that I can test this PR. Hopefully that will be soon

tvoverbeek commented 1 year ago

@G3zz Just FYI tested myself on Sense Hat v2 (with TCS3400) and Sense Hat V1 (wthout colour sensor). For obvious reasons I could not test it on the ISS version with TCS34725.

G3zz commented 1 year ago

Thank you. I should have acquired a TCS3400 HAT by next week, I hope - so I should be able to test all three HAT versions next week. G3zz

lurch commented 1 year ago

I guess the colour sensor also ought to be mentioned on https://github.com/astro-pi/python-sense-hat/blob/master/README.md ?

G3zz commented 11 months ago

I had a very hard time getting hold of a TCS3400 HAT in the end, as I kept getting sent one with a TCS34725 version... I've finally got one and tested your PR and it works well - thank you very much!