Open ZGMFX20AR opened 6 months ago
Are you using the same Sense HAT in both cases? I think newer Sense HATs have the colour sensor on 0x39. Tested on a pi5 here and the output was as expected.
I think the library or package (for ubuntu?) might not be updated in this case.
from sense_hat import SenseHat
from time import sleep
sense = SenseHat()
sense.color.gain = 60
sense.color.integration_cycles = 64
while True:
sleep(2 * sense.colour.integration_time)
red, green, blue, clear = sense.colour.colour # readings scaled to 0-256
print(f"R: {red}, G: {green}, B: {blue}, C: {clear}")
Error:
Traceback (most recent call last):
File "/home/piuser/csense.py", line 5, in <module>
sense.color.gain = 60
^^^^^^^^^^^
AttributeError: 'SenseHat' object has no attribute 'color'
Tested on Ubuntu 24.04
Spell it correctly and it should work?
colour
You have it correct later.
Erm... the official documentation is using color though https://projects.raspberrypi.org/en/projects/getting-started-with-the-sense-hat/7
Anyway I managed to fix it by just using Rasbian as the default OS. After setting up Ubuntu via docker and fooling around with building this repo and the RTIMU repo from source, I am thinking the Ubuntu 24.04 issue might be a result of outdated packages in the repo..
They must have changed it at some point, it never used to work. At least I don't think it did.
Anyway, glad it working.
For the record, it's not Raspbian, it is RaspberryPi OS. It would be better to call it Debian as it's not using Raspbian any more. (see history in some old blog, also Raspbian was 32bit only).
On Sun, 5 May 2024, 11:16 pm yupm, @.***> wrote:
Erm... the official documentation is using color though
https://projects.raspberrypi.org/en/projects/getting-started-with-the-sense-hat/7 image.png (view on web) https://github.com/astro-pi/python-sense-hat/assets/35495603/5a030c2f-c236-4b08-ba17-5fc54fd7178c
Anyway I managed to fix it by just using Rasbian as the default OS. After setting up Ubuntu via docker and fooling around with building this repo and the RTIMU repo from source, I am thinking the Ubuntu 24.04 issue might be a result of outdated packages in the repo..
— Reply to this email directly, view it on GitHub https://github.com/astro-pi/python-sense-hat/issues/143#issuecomment-2094970821, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYAXN3LGLMDEDHDCZMMNULZA2VTVAVCNFSM6AAAAABDWH74F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUHE3TAOBSGE . You are receiving this because you commented.Message ID: @.***>
It's seems it was 4 years ago they added color as spelling :-)
Hello, I'm experiencing an issue with the Sense HAT v2 on the Raspberry Pi 5.
When executing the i2cdetect -y 1 command on the Pi 5, it successfully detects all sensors except for the color sensor.
Conversely, on the Pi 4, the command detects all sensors including the color sensor, which has an I2C address of 0x29.