Skip to content

Commit ad6bb0e

Browse files
authored
Added getPixelColorRGBW to include White
Hi, I would live to retrieve the white color aswell in the same clean way instead of doing it manually with the getPixelColor(). Ty for this amazing code, I was able to do an awesome led project with rpi, bluetooth and a phone app.
1 parent 4d3f84c commit ad6bb0e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/rpi_ws281x/rpi_ws281x.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ def getPixelColorRGB(self, n):
178178
setattr(c, 'g', self._led_data[n] >> 8 & 0xff)
179179
setattr(c, 'b', self._led_data[n] & 0xff)
180180
return c
181+
182+
def getPixelColorRGBW(self, n):
183+
c = lambda: None
184+
setattr(c, 'w', self._led_data[n] >> 24 & 0xff)
185+
setattr(c, 'r', self._led_data[n] >> 16 & 0xff)
186+
setattr(c, 'g', self._led_data[n] >> 8 & 0xff)
187+
setattr(c, 'b', self._led_data[n] & 0xff)
188+
return c
181189

182190
# Shim for back-compatibility
183191
class Adafruit_NeoPixel(PixelStrip):

0 commit comments

Comments
 (0)