Skip to content
Michael Miller edited this page Jul 5, 2023 · 48 revisions

See NeoPixelBus object API Reference for more details on the methods exposed.

This is the primary object that is used to set colors on the pixels. When constructed, a "feature" and a "method" object must be supplied to define which pixels you are using and how they are updated.

NeoPixelBus<FEATURE, METHOD> strip(pixelCount, pixelPin);

Below is an example to create one for most platforms. It will manage 16 pixels on pin 2. The pixels use the most common WS2812x protocol, and the most common color order of Green, Red, and then Blue.

NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip(16, 2);

For the Esp8266 platforms, you can omit the pin argument as it is ignored. This is due to hardware support that doesn't allow for selecting a pin.

NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip(16);

If you want to drive DotStars (two wire) instead, use the following to create a bus that uses hardware SPI.

NeoPixelBus<DotStarBgrFeature, DotStarSpiMethod> strip(32);

If you want to drive DotStars using software SPI, use the following to create a bus and provide the pins for clock and data lines.

NeoPixelBus<DotStarBgrFeature, DotStarMethod> strip(32, clockPin, dataPin);
Clone this wiki locally