Skip to content
Snippets Groups Projects
Commit 13d06a83 authored by Mike Causer's avatar Mike Causer Committed by Paul Sokolovsky
Browse files

esp8266/scripts/: Add fill() to NeoPixel

parent 0c86a947
Branches
No related tags found
No related merge requests found
...@@ -20,5 +20,12 @@ class NeoPixel: ...@@ -20,5 +20,12 @@ class NeoPixel:
i = index * 3 i = index * 3
return self.buf[i + 1], self.buf[i], self.buf[i + 2] 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): def write(self):
neopixel_write(self.pin, self.buf, True) neopixel_write(self.pin, self.buf, True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment