User Manual

Multiple pixels can be set to the same color using the fill() function, which accepts one to three arguments. Typically it’s
called like this:
“color” is a packed 32-bit RGB (or RGBW) color value, as might be returned by strip.Color(). There is no option here for
separate red, green and blue, so call the Color() function to pack these into one value.
“first” is the index of the first pixel to fill, where 0 is the first pixel in the strip, and strip.numPixels() - 1 is the last. Must be
a positive value or 0.
“count” is the number of pixels to fill. Must be a positive value.
If called without a
count
argument (only color and first), this will from
first
to the end of the strip.
If called without
first
or
count
arguments (only color), the full strip will be set to the requested color.
If called with
no
arguments, the strip will be filled with black or “off,” but there’s also a different syntax which might be
easier to read:
You can query the color of a previously-set pixel using getPixelColor() :
This returns a 32-bit merged color value (only the least 24 bits are used).
The number of pixels in a previously-declared strip can be queried using numPixels() :
The overall brightness of all the LEDs can be adjusted using setBrightness() . This takes a single argument, a number
in the range 0 (off) to 255 (max brightness). For example, to set a strip to 1/4 brightness:
Just like setPixel() , this does not have an immediate effect.You need to follow this with a call to show() .
HSV (Hue-Saturation-Value) Colors…
The DotStar library has some support for colors in the “HSV” (hue-saturation-value) color space. This is a different way
of specifying colors than the usual RGB (red-green-blue). Some folks find it easier or more “natural” to think about…or
quite often it’s just easier for certain color effects (the popular rainbow cycle and such).
strip.fill(color, first, count);
strip.clear();
uint32_t color = strip.getPixelColor(11);
uint16_t n = strip.numPixels();
strip.setBrightness(64);
© Adafruit Industries https://learn.adafruit.com/adafruit-dotstar-leds Page 29 of 48