Author(s): Damien P. George, Scott Shawcroft, Carter Nelson, Rose Hooper
- neopixel.GRB = 'GRB'¶
Green Red Blue
- neopixel.GRBW = 'GRBW'¶
Green Red Blue White
- class neopixel.NeoPixel(pin: Pin, n: int, *, bpp: int = 3, brightness: float = 1.0, auto_write: bool = True, pixel_order: str = None)¶
A sequence of neopixels.
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
pixel_order (str) – 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)
Shows the new colors on the pixels themselves if they haven’t already been autowritten.
The colors may or may not be showing after this function returns because it may be done asynchronously.
Colors all pixels the given *color*.
Overall brightness of the pixel (0 to 1.0)
- neopixel.RGB = 'RGB'¶
Red Green Blue
- neopixel.RGBW = 'RGBW'¶
Red Green Blue White