RGB control
Opened this issue · 1 comments
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)
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)