- Author(s): Damien P. George & Scott Shawcroft
GRB= (1, 0, 2)¶
Green Red Blue
GRBW= (1, 0, 2, 3)¶
Green Red Blue White
NeoPixel(pin, n, *, bpp=3, brightness=1.0, auto_write=True, pixel_order=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
- auto_write (bool) – True if the neopixels should immediately change when set. If False,
showmust 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)
Overall brightness of the pixel
Blank out the NeoPixels and release the pin.
Colors all pixels the given *color*.
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.
showinstead. It matches Micro:Bit and Arduino APIs.
RGB= (0, 1, 2)¶
Red Green Blue
RGBW= (0, 1, 2, 3)¶
Red Green Blue White