Skip to main content

Introduction

Discord Build Status Code Style: Ruff Demo animation

Pixel Mapper for Adafruit_CircuitPython_LED_Animation

This library provides custom pixel mappers for use with the Adafruit CircuitPython LED Animation library.

The built-in mappers only support arranging multiple matrices in the direction the internal LED strip is physically wired. This library extends that functionality by allowing you to stack panels vertically or horizontally, regardless of wiring direction.

You can also apply optional x and y offsets, making it easier to treat sections of a larger matrix as independent regions — without manually defining complex pixel maps.

Key Features

Combine multiple LED panels into vertical or horizontal matrix layouts

Support for snaking layouts (e.g. zigzag wiring patterns)

Optional x/y offsets for sub-matrix mapping

Compatible with Adafruit’s CircuitPython LED Animation library

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install circuitpython-pixel-mapper

To install system-wide (this may be required in some cases):

sudo pip3 install circuitpython-pixel-mapper

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install circuitpython-pixel-mapper

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install pixel_mapper

Or the following command to update an existing version:

circup update

Usage Example

import board
import neopixel

from adafruit_led_animation import helper
from adafruit_led_animation.animation.chase import Chase
from adafruit_led_animation.animation.comet import Comet
from adafruit_led_animation.animation.rainbowchase import RainbowChase
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
from adafruit_led_animation.color import AMBER, JADE, PURPLE, RED, GREEN, BLUE,OLD_LACE,ORANGE
from pixel_mapper import vertical_stacked_panels_mapper

# Update to match the pin connected to your NeoPixels
pixel_pin = board.GP2
# Update to match the number of NeoPixels you have connected
pixel_num = 1024

pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.75, auto_write=False)
pixels.fill((0, 0, 0))

pixel_wing_top_left = helper.PixelMap.horizontal_lines(
    pixels,
    16,
    16,
    vertical_stacked_panels_mapper(32, 32, panel_height=8, reverse=True, x_offset=16, y_offset=16),
)

pixel_wing_botom_left = helper.PixelMap.horizontal_lines(
    pixels,
    16,
    16,
    vertical_stacked_panels_mapper(32, 32, panel_height=8, reverse=True, x_offset=16)
)

pixel_wing_top_right = helper.PixelMap.horizontal_lines(
    pixels,
    16,
    16,
    vertical_stacked_panels_mapper(32, 32, panel_height=8, reverse=True, y_offset=16),
)

pixel_wing_botom_right = helper.PixelMap.horizontal_lines(
    pixels,
    16,
    16,
    vertical_stacked_panels_mapper(32, 32, panel_height=8, reverse=True)
)

comet = Comet(pixel_wing_top_left, speed=0.1, color=AMBER, tail_length=6, bounce=True)
chase = Chase(pixel_wing_botom_left, speed=0.1, size=3, spacing=6, color=JADE)
rainbow_chase = RainbowChase(pixel_wing_top_right, speed=0.1, size=3, spacing=2, step=8)
rainbow_comet = RainbowComet(pixel_wing_botom_right, speed=0.05, tail_length=7, bounce=True)

while True:
    comet.animate()
    chase.animate()
    rainbow_chase.animate()
    rainbow_comet.animate()

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Metadata

Release files for circuitpython-pixel-mapper 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for circuitpython-pixel-mapper 1.0.4
File Size Uploaded Provenance
circuitpython_pixel_mapper-1.0.4.tar.gz 24.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for circuitpython-pixel-mapper 1.0.4
File Interpreter ABI Platform
circuitpython_pixel_mapper-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 30.3 kB

Release files / circuitpython_pixel_mapper-1.0.4.tar.gz

Download URL circuitpython_pixel_mapper-1.0.4.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
07b6406dcd222acf8b4753909272f524c4e8474e7827bc6fbd49050ee22db445
BLAKE2b-256 checksum
How to use checksums
ba56cfa8f4f6a576c0aa4a1b2a3d716f5b1b0216f8c9db6d33ed3102e11cc0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release files / circuitpython_pixel_mapper-1.0.4-py3-none-any.whl

Download URL circuitpython_pixel_mapper-1.0.4-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
381734c4f71b382568a0082fdc392d2ef180b464acb56d4485c412f390191900
BLAKE2b-256 checksum
How to use checksums
7548bc4f563d461bba656073b04b195ee5a2ca43e3964cb01eaa18e89b3f3f86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Security for circuitpython-pixel-mapper 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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