Frame-buffer based LED Matrix displays for MicroPython
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2023-07-09 16:30:49 +02:00
examples Add game of life example 2023-04-29 17:47:58 +02:00
myfrabuled remove bug in get function 2023-07-09 16:30:49 +02:00
LICENSE Add license and comments 2023-04-29 17:47:47 +02:00
README.md Support __getitem__ and __setitem__ 2023-04-29 18:07:40 +02:00

µ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.