Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the RGB value of a LED using getPixelColor() URGET :( #247

Closed
Icsaac opened this issue Dec 7, 2017 · 5 comments
Closed

How to get the RGB value of a LED using getPixelColor() URGET :( #247

Icsaac opened this issue Dec 7, 2017 · 5 comments

Comments

@Icsaac
Copy link

Icsaac commented Dec 7, 2017

Hi,

Ive been trying to get the RGB value of a specific LED light using the function getPixelColor().But when I try to print the function value, the only thing a I get is 0. Any help with this. Im using this simple code:

for i in range(strip.numPixels()):
value=strip.getPixelColor(i)
print(value)

@penfold42
Copy link
Contributor

Did you set any colours beforehand ?

@Icsaac
Copy link
Author

Icsaac commented Dec 7, 2017

Yeah, all my strip to white (10 LEDS) RGB(255,255,255)

@Gadgetoid
Copy link
Collaborator

Could you post the code you're using to set the pixel colours?

I've run quick test with the latest library code, and I can't seem to replicate this.

@Gadgetoid
Copy link
Collaborator

I just saw #245 - if you are expecting getPixelColor to read the colour of an LED back from the hardware, you'll be disappointed. The LEDs are write-only. getPixelColor can only read back the state from the libraries memory buffer.

You must either save your state externally, or set your script up to run continuously.

Note: It's not generally a good idea to write pixel state and expect the hardware to maintain the colour you have set. It's easy for electrical interference to be interpreted by the LEDs as signal, and this may result in random, unexpected changes. You should continuously refresh the pixels with the desired state.

@Gadgetoid
Copy link
Collaborator

Since there has been no input on this for a few months, I'm closing it for housekeeping. Feel free to re-open if you have further questions or comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants