Skip to content
Snippets Groups Projects
Name Last commit Last update
examples
myfrabuled
LICENSE
README.md

µfrabuled - Frame-buffer based LED Matrix displays for MicroPython

This library wraps LED dot matrix displays in MicroPython, e.g. the WEMOS Matrix LED Shield.

It keeps the display state in an internal frame buffer, so it can easily be handled and then written to the display.

Usage

from myfrabuled import WEMOSMatrixLEDShield

# Initialize the WEMOS shield with default pins
shield = WEMOSMatrixLEDShield()

# Set a single pixel
shield[5,5] = True
shield.on(5, 5)
shield.off(5, 5)

# Copy a 4x4 bitmap to the framebuffer's middle
bitmap = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]
shield.blit(bitmap, dest_offset=(2, 2))

# Update the display (render the framebuffer)
shield.update()

Extensibility

The library is designed to be capable of adding support for other LED Matrix displays/shields. A new class needs to implement the update and brightness methods; everything high-level is implemented in the base class:

from .base import LEDMatrix

class MyMatrixShield(LEDMatrix):
    def update(self):
        # Implement writing self.fb to the display here

    def brightness(self, intensity: int, active: bool = True):
        # Implement setting the display brightness here

Feel free to send merge requests or issues on the EduGit project!

Credits and license

µfrabuled was created for use in Hack'n'Fun workshops at Teckids e.V..

It is based on prior art by Matt Trentini and licensed under the MIT license.