diff options
Diffstat (limited to 'esp8266/scripts/neopixel.py')
-rw-r--r-- | esp8266/scripts/neopixel.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/esp8266/scripts/neopixel.py b/esp8266/scripts/neopixel.py index 4818c74a3b..8aa0348680 100644 --- a/esp8266/scripts/neopixel.py +++ b/esp8266/scripts/neopixel.py @@ -8,7 +8,7 @@ class NeoPixel: self.pin = pin self.n = n self.buf = bytearray(n * 3) - self.pin.init(pin.OUT, pin.PULL_NONE) + self.pin.init(pin.OUT) def __setitem__(self, index, val): r, g, b = val @@ -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) |