adafruit_dotstar
- DotStar strip driver (for CircuitPython 5.0+ with _pixelbuf)¶
- Author(s): Damien P. George, Limor Fried, Scott Shawcroft & Rose Hooper
-
adafruit_dotstar.
BGR
= 'PBGR'¶ Blue Green Red
-
adafruit_dotstar.
BRG
= 'PBRG'¶ Blue Red Green
-
class
adafruit_dotstar.
DotStar
(clock, data, n, *, brightness=1.0, auto_write=True, pixel_order='PBGR', baudrate=4000000)[source]¶ A sequence of dotstars.
Parameters: - clock (Pin) – The pin to output dotstar clock on.
- data (Pin) – The pin to output dotstar data on.
- n (int) – The number of dotstars in the chain
- brightness (float) – Brightness of the pixels between 0.0 and 1.0
- auto_write (bool) – True if the dotstars should immediately change when
set. If False,
show
must 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.
- baudrate (int) – Desired clock rate if using hardware SPI (ignored if using ‘soft’ SPI). This is only a recommendation; the actual clock rate may be slightly different depending on what the system hardware can provide.
Example for Gemma M0:
import adafruit_dotstar import time from board import * RED = 0x100000 with adafruit_dotstar.DotStar(APA102_SCK, APA102_MOSI, 1) as pixels: pixels[0] = RED time.sleep(2)
-
show
()¶ Shows the new colors on the dotstars 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 dotstars the given *color*.
-
brightness
¶ Overall brightness of all dotstars (0 to 1.0)
-
n
¶ The number of dotstars in the chain (read-only)
-
adafruit_dotstar.
GBR
= 'PGBR'¶ Green Blue Red
-
adafruit_dotstar.
GRB
= 'PGRB'¶ Green Red Blue
-
adafruit_dotstar.
RBG
= 'PRBG'¶ Red Blue Green
-
adafruit_dotstar.
RGB
= 'PRGB'¶ Red Green Blue