audio-reactive-led-strip icon indicating copy to clipboard operation
audio-reactive-led-strip copied to clipboard

RGBW Query

Open NickSutton opened this issue 6 years ago • 4 comments

Hi, just testing out the LED’s now I’ve got the full strip working but not seeing much white... Does this line ((https://github.com/scottlawsonbc/audio-reactive-led-strip/blob/e6964c27f025708df3d0d903f54b14539391cce2/python/led.py#L101)) require modifying to send a white value?

Thanks

NickSutton avatar Oct 22 '19 19:10 NickSutton

Yes, I don't know where it was lost on me that you aren't using an Arduino and are in fact using an RPI but at the minimum, you would have to pass in a fourth parameter to set the white led to off and probably a few other tweaks to the code.

joeybab3 avatar Oct 24 '19 01:10 joeybab3

Thanks Joey, I think I can muddle through the code and add a fourth parameter where appropriate, but I’m a bit confused by the way the variables are nested in the line above.

Would the following be acceptable: rgb = np.bitwise_or(np.bitwise_or(np.bitwise_or(r, g), b), w)

NickSutton avatar Oct 28 '19 09:10 NickSutton

OK, I’ve not made any progress with this, but suspect the answer lies in the following lines of code:

# Encode 24-bit LED values in 32 bit integers r = np.left_shift(p[0][:].astype(int), 8) g = np.left_shift(p[1][:].astype(int), 16) b = p[2][:].astype(int) rgb = np.bitwise_or(np.bitwise_or(r, g), b) # Update the pixels

I think rgb = np.bitwise_or(np.bitwise_or(r, g), b)) needs to become rgbw = np.bitwise_or(np.bitwise_or(np.bitwise_or(r, g), b), w) but unsure how to construct a string to define ‘w’ ... Any pointers?

NickSutton avatar Nov 13 '19 15:11 NickSutton

Unfortunately, I don't know much about the algorithm, so I wouldn't be too helpful in this regard. I can suggest trying to just duplicate one of the other color channels and sending that to white?

ex:

# Encode 24-bit LED values in 32 bit integers
r = np.left_shift(p[0][:].astype(int), 8)
g = np.left_shift(p[1][:].astype(int), 16)
b = p[2][:].astype(int)
w = p[2][:].astype(int)
rgbw = np.bitwise_or(np.bitwise_or(np.bitwise_or(r, g), b), w)
# Update the pixels

Though that might just screw everything up.

You could also just apply some scalar/add some value to the red/green/blue channel and use that as the white and do that?

joeybab3 avatar Nov 14 '19 04:11 joeybab3