API Reference
adafruit_ws2801 - WS2801 LED pixel string driver
Author(s): Damien P. George, Limor Fried & Scott Shawcroft, Kevin J Walters, Tim Cocks
- adafruit_ws2801.BGR = 'PBGR'
Blue Green Red
- adafruit_ws2801.BRG = 'PBRG'
Blue Red Green
- adafruit_ws2801.GBR = 'PGBR'
Green Blue Red
- adafruit_ws2801.GRB = 'PGRB'
Green Red Blue
- adafruit_ws2801.RBG = 'PRBG'
Red Blue Green
- adafruit_ws2801.RGB = 'PRGB'
Red Green Blue
- class adafruit_ws2801.WS2801(clock: Pin, data: Pin, n: int, *, brightness: float = 1.0, auto_write: bool = True, pixel_order: str = 'RGB')
A sequence of WS2801 controlled LEDs.
- Parameters:
clock (Pin) – The pin to output dotstar clock on.
data (Pin) – The pin to output dotstar data on.
n (int) – The number of LEDs in the chain.
brightness (float) – The brightness between 0.0 and (default) 1.0.
auto_write (bool) – True if the dotstars should immediately change when set. If False,
showmust be called explicitly.pixel_order (str) – Set the pixel order on the strip - different strips implement this differently. If you send red, and it looks blue or green on the strip, modify this! It should be one of the values above.
Example for Gemma M0:
import adafruit_ws2801 import time import board darkred = 0x100000 with adafruit_ws2801.WS2801(board.D2, board.D0, 25, brightness=1.0) as pixels: pixels[0] = darkred time.sleep(2)
- show()
Shows the new colors on the ws2801 LEDs 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.
- fill(color)
Colors all ws2801 LEDs the given *color*.
- brightness
Overall brightness of all ws2801 LEDs (0 to 1.0)