Skip to content

Commit 13d06a8

Browse files
mcauserpfalcon
authored andcommitted
esp8266/scripts/: Add fill() to NeoPixel
1 parent 0c86a94 commit 13d06a8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

esp8266/scripts/neopixel.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,12 @@ def __getitem__(self, index):
2020
i = index * 3
2121
return self.buf[i + 1], self.buf[i], self.buf[i + 2]
2222

23+
def fill(self, color):
24+
r, g, b = color
25+
for i in range(len(self.buf) / 3):
26+
self.buf[i * 3] = g
27+
self.buf[i * 3 + 1] = r
28+
self.buf[i * 3 + 2] = b
29+
2330
def write(self):
2431
neopixel_write(self.pin, self.buf, True)

0 commit comments

Comments
 (0)