neopixel
- NeoPixel strip driver¶
- Author(s): Damien P. George & Scott Shawcroft
-
neopixel.
GRB
= (1, 0, 2)¶ Green Red Blue
-
neopixel.
GRBW
= (1, 0, 2, 3)¶ Green Red Blue White
-
class
neopixel.
NeoPixel
(pin, n, *, bpp=3, brightness=1.0, auto_write=True, pixel_order=None)[source]¶ A sequence of neopixels.
Parameters: - pin (Pin) – The pin to output neopixel data on.
- n (int) – The number of neopixels in the chain
- bpp (int) – Bytes per pixel. 3 for RGB and 4 for RGBW pixels.
- brightness (float) – Brightness of the pixels between 0.0 and 1.0 where 1.0 is full brightness
- auto_write (bool) – True if the neopixels should immediately change when set. If False,
show
must be called explicitly. - pixel_order (tuple) – Set the pixel color channel order. GRBW is set by default.
Example for Circuit Playground Express:
import neopixel from board import * RED = 0x100000 # (0x10, 0, 0) also works pixels = neopixel.NeoPixel(NEOPIXEL, 10) for i in range(len(pixels)): pixels[i] = RED
Example for Circuit Playground Express setting every other pixel red using a slice:
import neopixel from board import * import time RED = 0x100000 # (0x10, 0, 0) also works # Using ``with`` ensures pixels are cleared after we're done. with neopixel.NeoPixel(NEOPIXEL, 10) as pixels: pixels[::2] = [RED] * (len(pixels) // 2) time.sleep(2)
-
brightness
¶ Overall brightness of the pixel
-
neopixel.
RGB
= (0, 1, 2)¶ Red Green Blue
-
neopixel.
RGBW
= (0, 1, 2, 3)¶ Red Green Blue White