API Reference

Board Types

enum BoardType : uint8_t {
  BOARD_NEORING,      // 2 rings x 48 LEDs = 96 LEDs per board
  BOARD_NEORING_XL,   // 3 rings x 60 LEDs = 180 LEDs per board
  BOARD_QUADPIXEL,    // 4 LEDs, no rings
};

Each board type has a geometry definition stored in flash (PROGMEM):

BoardLEDs/RingRingsTotal LEDs
BOARD_NEORING48296
BOARD_NEORING_XL603180
BOARD_QUADPIXEL04

Constants

#define RP_MAX_BOARDS        8    // Max boards on one data pin
#define RP_MAX_LEDS_PER_RING 60   // Largest ring across all board types

Constructors

Uniform Chain

All boards are the same type. This is the simplest form and is backward-compatible with v1.0.

RobotechPixel(BoardType boardType, uint8_t numBoards, uint8_t pin)
RobotechPixel px(BOARD_NEORING, 3, 7);  // 3 NeoRings on pin 7

Mixed Chain

Each board in the chain can be a different type. Pass an array of BoardType values in daisy-chain order.

RobotechPixel(const BoardType* types, uint8_t numBoards, uint8_t pin)
const BoardType chain[] = { BOARD_NEORING, BOARD_NEORING_XL, BOARD_NEORING };
RobotechPixel px(chain, 3, 7);

The library automatically computes the total pixel count and per-board offsets.

Lifecycle

void begin()           // Initialize the LED strip
void show()            // Push LED data to the strip
void clear()           // Set all LEDs to off (must call show() to apply)

Brightness

void setBrightness(uint8_t b)    // Set brightness (0–255)
uint8_t getBrightness() const    // Get current brightness

LED Access

By Global Index

void setLed(int globalIndex, uint32_t color)

Sets a single LED by its position in the entire chain (0 to getTotalPixels()-1).

By Ring Position

// Full form: board, ring, LED index
void setRingLed(int pcbIndex, int ringIndex, int ledIndex, uint32_t color)

// Board 0 shorthand: ring, LED index
void setRingLed(int ringIndex, int ledIndex, uint32_t color)

// Board 0, ring 0 shorthand: LED index only
void setRingLed(int ledIndex, uint32_t color)
ParameterDescription
pcbIndexBoard number (0-based)
ringIndexRing number (0 = innermost ring)
ledIndexPosition within the ring (0 to ledsPerRing-1)

Note: For non-ring boards (QuadPixel), ringIndex is ignored and ledIndex addresses LEDs directly.

Color Helper

static uint32_t color(uint8_t r, uint8_t g, uint8_t b)

Creates a packed 32-bit color value from RGB components.

Geometry Queries

Per-Board (recommended)

BoardType getBoardType(uint8_t board) const   // Board type at this position
uint8_t getLedsPerRing(uint8_t board) const   // LEDs per ring on this board
uint8_t getNumRings(uint8_t board) const      // Number of rings on this board
uint16_t getLedsPerBoard(uint8_t board) const // Total LEDs on this board
uint16_t getBoardOffset(uint8_t board) const  // Global pixel offset of this board
bool boardHasRings(uint8_t board) const       // True if board has ring geometry

Global

uint8_t getNumBoards() const       // Total boards in the chain
uint16_t getTotalPixels() const    // Total LEDs across all boards

Backward-Compatible (returns board 0 values)

BoardType getBoardType() const     // Same as getBoardType(0)
uint16_t getLedsPerRing() const    // Same as getLedsPerRing(0)
uint16_t getLedsPerBoard() const   // Same as getLedsPerBoard(0)

Ring Mapping

int innerPixel(int board, int idx) const   // Global index for innermost ring LED
int outerPixel(int board, int idx) const   // Global index for second ring LED
void setPathPixel(int board, int pathPos, uint32_t color)  // Continuous path across all rings

Pixel Helpers

void fadeAll(uint8_t factor)              // Fade all LEDs (0=instant off, 255=no change)
void fadePixel(int index, uint8_t factor) // Fade a single LED
uint32_t getPixelColor(int index) const   // Get current color of a LED

Adding New Board Types

To add a new board, two changes are needed in RobotechPixel.h / .cpp:

  1. Add an entry to the BoardType enum (before BOARD_TYPE_COUNT)
  2. Add a row to the BOARD_DEFS PROGMEM table with { ledsPerRing, numRings, totalLeds }

No other code changes are needed — all geometry queries and effects adapt automatically.