mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
esp8266/scripts/: Add fill() to NeoPixel
This commit is contained in:
committed by
Paul Sokolovsky
parent
0c86a9471a
commit
13d06a83e1
@@ -20,5 +20,12 @@ class NeoPixel:
|
||||
i = index * 3
|
||||
return self.buf[i + 1], self.buf[i], self.buf[i + 2]
|
||||
|
||||
def fill(self, color):
|
||||
r, g, b = color
|
||||
for i in range(len(self.buf) / 3):
|
||||
self.buf[i * 3] = g
|
||||
self.buf[i * 3 + 1] = r
|
||||
self.buf[i * 3 + 2] = b
|
||||
|
||||
def write(self):
|
||||
neopixel_write(self.pin, self.buf, True)
|
||||
|
||||
Reference in New Issue
Block a user