CMozGlow

v1.1.0

The friendly WS2812B library for the CMoz ESP32-S3 Mini — running live below. This page executes the library's actual math: same gamma curve, same power budgeting, same effects, same error messages. Twenty pixels, zero soldering. TinkerTailor.ca · CMozMaker · made in Canada

pixel 0 · onboard, GPIO 3
effect Aurora ✈ AutoPilot · core 0 ⚠ auto-dimmed to fit budget

Controls every knob maps 1:1 to a library call

5
180
450 mA

Note the golden rule at work: NUM_LEDS = 20 here means the onboard pixel plus a 19-LED strip, all on GPIO 3.

Telemetry straight from show()

estimated draw
mA
frame interval
ms
library status
OK
sim fps
draw vs budget
0 mA450 mA budget

loop() laps/sec: (manual mode — your loop() shares time with the LEDs)

The current estimate uses the library's model: ~20 mA per fully-lit channel + ~1 mA idle per chip. Blow the budget and CMozGlow quietly dims the frame — try full-white Solid at max brightness.

Your sketch, written live copy → PlatformIO or Arduino IDE → identical result on hardware


  

why it's different

Built for wearables, not just walls of pixels

Other LED libraries assume a desk, a bench supply and a serial monitor. CMozGlow assumes a costume that's already sewn shut.

🚑

Errors in plain English

Every failing call returns false and errorText() tells you exactly what to fix — "pixel index is past the end of the strip." Try it in the playground below.

🔋

Power budgeting

setPowerBudgetmA(250) and the library estimates every frame's draw and auto-dims to keep your LiPo safe. Watch the gauge above do it in real time.

🟢

Status pixel

The onboard pixel becomes a live health light — green means happy, red means an error happened. Debugging for garments you can't plug in.

✈️

AutoPilot

One line — autoUpdate(true) — moves the LEDs to the S3's second CPU core. Your loop() stays 100% free for sensors, touch and Bluetooth. Thread-safe throughout.

Async hardware engine

show() hands frames to the RMT peripheral and returns in ~100 µs — even on long strips. The latch gap is encoded in hardware. No busy-waiting anywhere.

🎨

Gamma, on by default

Colours look the way you mixed them. Toggle it above and watch the mids shift — that's the 2.6 curve this page shares with the silicon.

the collection

Ten effects from the atelier

Named for fabric, runways and northern skies — not test patterns. Click any card to run it in the simulator.

interactive

The error playground

Make real mistakes, get the library's real answers — the exact strings compiled into v1.1.0. Turn on the status pixel first and watch pixel 0 go red.

// responses appear here…

hardware

Wiring in one breath

🧵 The golden rule: your board's onboard pixel lives on GPIO 3 and is pixel 0. Attach your strip's DIN to GPIO 3 too — it continues as pixel 1 onward. So NUM_LEDS = 1 + strip length.
CMoz ESP32-S3 Mini WS2812B strip ┌───────────────┐ │ [pixel 0] │ GPIO 3 ───────▶ DIN → ● ● ● ● ● … (pixels 1…n) │ onboard │ GND ───────▶ GND └───────────────┘ 5V from a supply that matches your power budget Long run? Add 300–500 Ω in the data line + 500–1000 µF across power. Conductive thread? Keep data under ~30 cm and sew a ground line alongside.

source of truth

API reference

Grouped the way you'll reach for it. Everything returns honestly: false means check errorText().

Lifecycle & pixels
CMozGlow glow(numLeds);            // GPIO 3 by default
CMozGlow glow(numLeds, pin);       // or any valid ESP32-S3 output pin
bool begin();                      // once in setup(); false → errorText()
void end();                        // lands AutoPilot, waits for hardware, frees memory
bool setPixel(i, r, g, b);         // bounds-checked, always
bool setPixel(i, color);           // packed 0xRRGGBB
uint32_t getPixel(i);
void fill(color);   void clear();
bool show();                       // async: hands the frame to hardware, returns in ~µs
uint16_t numPixels();
Look, feel & power safety
void setBrightness(0-255);         // non-destructive master dimmer
void setGamma(true/false);         // 2.6 curve, on by default
void setPowerBudgetmA(mA);         // 0 = unlimited
uint16_t estimatedCurrentmA();     // what the last frame drew (model)
bool powerLimited();               // did the library auto-dim?
Effects engine
bool setEffect(0-9);               // or CMOZ_FX_… constants
void setEffectColor(color);
bool setEffectSpeed(1-10);
bool setMorseMessage("TEXT 123");  // A-Z, 0-9, spaces, ≤63 chars
bool update();                     // every loop(); true when a frame drew
static const char* effectName(id);
AutoPilot (advanced)
bool autoUpdate(true);             // ✈ LEDs move to core 0; loop() is yours
bool autoUpdate(false);            // lands cleanly — never force-kills a task
bool autoRunning();

All calls stay thread-safe mid-flight: a recursive mutex guards the whole library. Landing waits for the task to confirm exit and for the in-flight frame to finish before any memory moves — no dangling tasks, no use-after-free.

Error handling
CMozError lastError();   const char* errorText();   void clearError();
void statusPixel(true);            // pixel 0: green = happy, red = error
codemeaning
CMOZ_OKeverything is fine
CMOZ_ERR_NOT_BEGUNbegin() wasn't called or failed
CMOZ_ERR_BAD_PINuse GPIO 0–21 or 33–48 (26–32 are the flash pins)
CMOZ_ERR_BAD_COUNTLED count must be 1–2000
CMOZ_ERR_ALLOCout of memory (very long strip)
CMOZ_ERR_RMTthe LED peripheral failed or timed out
CMOZ_ERR_INDEXpixel index past the end of the strip
CMOZ_ERR_BAD_EFFECTeffect number doesn't exist (0–9)
CMOZ_ERR_BAD_ARGargument out of range
CMOZ_ERR_TASKAutoPilot's task couldn't start or stop
Suggested power budgets
power sourcebudget
USB portsetPowerBudgetmA(450)
small LiPo (400 mAh)setPowerBudgetmA(250)
dedicated 5 V / 2 A supplysetPowerBudgetmA(1500)

The estimate is a model (~20 mA per fully-lit channel + ~1 mA idle per chip) — always leave headroom.

Copied!