NeoDriver
The Adafruit NeoDriver is an I2C-to-NeoPixel driver board based on the seesaw chip. It can control a strip of up to 60 NeoPixels over a single StemmaQT cable, removing the need for precise timing in the host sketch. See the Adafruit learn guide for wiring and hardware details.
Connection
Call startNeoDriver() inside preload(). The NeoDriver has no name parameter and emits no events.
let strip;
function preload() {
strip = startNeoDriver(addressOrIndex?);
}addressOrIndex number 0x60
The I2C address of the device, or an index (0–7) into the address list. Eight addresses are available, set by the A0, A1, and A2 solder jumpers on the back of the board:
| Address | Index | A0 | A1 | A2 |
|---|---|---|---|---|
| 0x60 | 0 | open | open | open |
| 0x61 | 1 | closed | open | open |
| 0x62 | 2 | open | closed | open |
| 0x63 | 3 | closed | closed | open |
| 0x64 | 4 | open | open | closed |
| 0x65 | 5 | closed | open | closed |
| 0x66 | 6 | open | closed | closed |
| 0x67 | 7 | closed | closed | closed |
Methods
setLength(value) Promise<void>
Sets the number of NeoPixels in the connected strip. Must be called before setting any pixel colors. value is the pixel count (maximum 60).
Methods (NeoPixel)
getBrightness() number
Returns the current brightness level as an integer from 0 (off) to 255 (full brightness). The default is 128.
getLength() number
Returns the number of NeoPixels on the device.
getPixelColor(index?) ColorObject
Returns the last known color of the pixel at index (defaults to 0) as a { red, green, blue } object with values from 0 to 255.
getPixelColors(offset?, length?) ColorObject[]
Returns an array of { red, green, blue } objects for the pixels starting at offset (default 0). If length is omitted, all pixels from the offset to the end are returned.
setBrightness(value) Promise<void>
Sets the global brightness for all pixels. value is clamped to 0–255 and rounded to the nearest integer.
setPixelColor(color) Promise<void>
setPixelColor(index, color) Promise<void>
Sets the color of a single pixel. When called with one argument the first pixel (index 0) is used. color accepts a { red, green, blue } object, a CSS hex string (e.g. "#ff0000"), or a packed 24-bit integer.
setPixelColors(colors) Promise<void>
setPixelColors(offset, colors) Promise<void>
Sets the colors of multiple pixels in one call. When called with one argument the update starts at pixel 0; provide an offset to start further along. Each entry in colors accepts the same formats as setPixelColor. Large updates are automatically split into chunks of 64 pixels.
Methods (BaseDevice)
connect() Promise<Response>
Opens the USB connection and sends the start command to the firmware. Calling it multiple times is safe — subsequent calls return the same promise. In p5.js you do not need to call this manually; startXxx() calls it for you inside preload().
Properties
Properties (BaseDevice)
id { type, address }
Identifies the device. type is the DeviceType enum value, address is the I2C address the device was started with.
isConnected boolean
true once the USB connection has been established and the firmware has acknowledged the device. In p5.js this is always true by the time setup() runs, because startXxx() waits for the connection inside preload().
Canvas Helpers
These global functions sample pixel colors from the p5 canvas and write them directly to NeoPixel LEDs. They are called in draw() after the canvas has been rendered. Each function accepts an optional offset and device:
- offset defaults to an internal counter that auto-advances by the number of pixels written, allowing multiple calls to fill a strip sequentially without manual bookkeeping.
- device defaults to the first NeoDriver started.
neoRect(x, y, width, height, offset?, device?) void
Samples a rectangular region of the canvas column-by-column (left to right, top to bottom within each column) and writes the colors to consecutive LEDs.
// Fill 8×8 LEDs from the top-left corner of the canvas
neoRect(0, 0, 8, 8);neoCircle(x, y, radius, numPixels, offset?, device?) void
Samples canvas colors at evenly spaced points around a circle and writes them to consecutive LEDs. Pixel 0 is at the top of the circle, advancing clockwise.
// Map 24 LEDs around a circle centered at (200, 200) with radius 80
neoCircle(200, 200, 80, 24);neoLine(x1, y1, x2, y2, numPixels, offset?, device?) void
Samples canvas colors at evenly spaced points along a line segment (inclusive of both endpoints) and writes them to consecutive LEDs.
// Map 12 LEDs along a diagonal from (0, 0) to (300, 200)
neoLine(0, 0, 300, 200, 12);