Back to engineering archive

Record 085 / Lighting and interaction

EEPROM lighting-menu firmware draft

An archived NeoPixel application stores colour, effect and LED-count settings as three EEPROM byte values. Button-hold durations select setting changes and a count menu.

Archived firmware draft
EEPROM settingsNeoPixel APIButton menus

Archived source flow

Archived EEPROM/menu paths: a startup-button branch writes defaults or restores three settings. The loop dispatches the selected LED mode. A pressed button blocks until release, then its duration routes colour, effect or count-menu changes and EEPROM writes. This is not a script interpreter or non-blocking tested controller.
Selected startup/menu paths reconstructed from archived source. Button and menu waits block normal updates; restored settings and zero-count cases are unguarded. Compilation and hardware operation are unverified. View diagram at full size

Technical notes

Startup and storage

Holding the button at startup selects fixed defaults and writes the three settings; otherwise those byte values are restored from EEPROM.

Button-duration routing

The loop calls displayLEDs() before checking the button. After a blocking wait for release, durations from 300 to under 1000 ms advance colour, 1000 to under 2500 ms advance effect, and 2500 ms or longer enter ledCountMenu(). The changed setting is written to EEPROM.

Count menu

Inside the blocking menu, a press shorter than 500 ms increments the count modulo NUM_LEDS + 1. A longer press restores the temporary colour/effect selections and exits; the caller then persists the count.

Material source limits

EEPROM-restored indices are not validated before palette use. The count menu allows zero, while line-brightness calculations divide by the count. Button timestamps use int, so timing on the intended target also needs validation.

Engineering archiveArchive record

Project enquiries

Discuss your project.

Tell us what you’re developing and where you need engineering support.

Discuss your project