adafruit_dotstar - DotStar strip driver

  • Author(s): Damien P. George, Limor Fried & Scott Shawcroft
class adafruit_dotstar.DotStar(clock, data, n, *, brightness=1.0, auto_write=True, pixel_order=(2, 1, 0), baudrate=4000000)[source]

A sequence of dotstars.

  • 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 (tuple) – 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

Overall brightness of the pixel


Blank out the DotStars and release the resources.


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.