Skip to main content

pymcu-lib-neopixel

WS2812 / NeoPixel addressable LED strips for PyMCU — compiled to native machine code, with no interpreter on the chip.

pymcu install neopixel

The same strip, three APIs

Which one you get depends on the stdlib layer your project declares. The import is always neopixel.

Native (stdlib unset):

from neopixel import NeoPixel

strip = NeoPixel("PD6", 8)
strip[0] = (255, 0, 0)
strip.show()

MicroPython (stdlib = ["micropython"]) — a MicroPython script, unchanged:

from machine import Pin
from neopixel import NeoPixel

np = NeoPixel(Pin(6), 8)
np[0] = (255, 0, 0)
np.write()

CircuitPython (stdlib = ["circuitpython"]) — a CircuitPython script, unchanged:

import board
import neopixel

pixels = neopixel.NeoPixel(board.D6, 8, auto_write=False)
pixels.fill((0, 32, 0))
pixels.show()

None of those three files contains a single conditional: the layer adapters are plain Python written against each API as it is documented upstream. Everything that has to know about a chip lives in one private module, _neopixel_core, and the compiler folds it away.

Cost

Colours live in a per-strip SRAM framebuffer, 3 bytes per pixel in WS2812 wire order — 24 bytes for a strip of 8, and nothing else. Every method is @inline, so no object is allocated on the device and no method call survives compilation.

Measured figures per chip are published in the library index.

Supported hardware

WS2812 / WS2812B / NeoPixel strips on AVR (ATmega328P and friends) at 16 MHz. Bit timing is cycle-exact, so show() / write() disables interrupts for the duration of the transmission and restores them afterwards.

Other architectures raise a compile-time error rather than returning something that looks like it worked. Ports are welcome: _neopixel_avr.py is the whole contract.

License

MIT.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymcu_lib_neopixel-0.1.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymcu_lib_neopixel-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file pymcu_lib_neopixel-0.1.0.tar.gz.

File metadata

  • Download URL: pymcu_lib_neopixel-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pymcu_lib_neopixel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c70a34eaec809e9a19b58a79bcb44c1d10662417329f96947c85a7125887949f
MD5 c0ac39bc9efa644bb5e87aad436cfeb5
BLAKE2b-256 f43c25ec05e62d8d2f8d895d33d4c3cfa770749cfb0029bc9526969bab4da16f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymcu_lib_neopixel-0.1.0.tar.gz:

Publisher: publish.yml on PyMCU/pymcu-lib-neopixel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymcu_lib_neopixel-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymcu_lib_neopixel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fe98f2bb09c01991d53b422b72f1ccdab53e22aedde004177536c8b0f66312c
MD5 8c795bea487494b21c249a90569dc091
BLAKE2b-256 f53e20bb027b0471d14df5c1c64d077ab9cdcbf6d482e756bb4fa8405a01cf28

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymcu_lib_neopixel-0.1.0-py3-none-any.whl:

Publisher: publish.yml on PyMCU/pymcu-lib-neopixel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.0

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page