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

RGB control #3

Open
stutteringp0et opened this issue Apr 13, 2021 · 1 comment
Open

RGB control #3

stutteringp0et opened this issue Apr 13, 2021 · 1 comment

Comments

@stutteringp0et
Copy link

What the heck is wrong with the RGB control?

Using the supplied rgb.py script, it turns on random LEDs to random colors every time I run it.

The last line of the script is:

setRGB(Max_LED, 0, 0, 255)

As I read it, Max_LED sets all 3 lights, no red or green, and 100% blue - so this line says turn all 3 lights blue (0,0,255)....but that isn't what happens. I may or may not get all 3 lights, the lights that do turn on may or may not be blue. It seems completely random.

When I write a script to control a single LED, turning LED0 white (255,255,255) - it's a toss up as to which LED comes on, and what color it is when it does.

import smbus
import time
bus = smbus.SMBus(1)

addr = 0x0d
rgb_off_reg = 0x07

def setRGB0(r, g, b):
    bus.write_byte_data(addr, rgb_off_reg, 0x00)
    #time.sleep(2)
    bus.write_byte_data(addr, 0x00, 0&0xff)
    bus.write_byte_data(addr, 0x01, r&0xff)
    bus.write_byte_data(addr, 0x02, g&0xff)
    bus.write_byte_data(addr, 0x03, b&0xff)

setRGB0(255,255,255)
@stutteringp0et
Copy link
Author

Even the command to turn the LEDs off isn't consistent.

If I run this from the python shell, it occasionally turns the LEDs on!

bus.write_byte_data(addr, rgb_off_reg, 0x00)

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

1 participant