Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 2.39 KB

README.md

File metadata and controls

64 lines (41 loc) · 2.39 KB

MicroPython MAX7219 8x8 LED Matrix

A MicroPython library for the MAX7219 8x8 LED matrix driver, SPI interface, supports cascading and uses framebuf

How to use

import matrix
matrix = matrix.Matrix()

At the moment, only three methods (text, scroll and shape) added to the Matrix class whitch samples can be found in /examples directory, more will be added later. Fill free to make suggestions, pull requests are wellcome.

matrix.text(txt = 'F', x = 0, y = 0, c = 1)

which x is horizontal offset default is zero, y is vertical offset default is zero and c is color default is 1.

matrix.scroll(txt = 'Scrolling text example', s = 0.1, c = 1, loops = 2)

which x, y and c as above, s is speed of scrolling default is 0.1 second and loops is the number of times one text can be scrolled. Default is zero which means unlimited.

shape = [[0,0,0,0,0,0,0,0], [0,1,1,0,0,1,1,0], [1,0,0,1,1,0,0,1], [1,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,1], [0,1,0,0,0,0,1,0], [0,0,1,0,0,1,0,0], [0,0,0,1,1,0,0,0]]
matrix.shape(patern = shape, delay = 0)

which shape is an array of values zero or one values for each pixel. the aboce shape, will display a heart.

The default value for delay (not the best name, but this was the best I found!) is zero. If zero, it just display the shape, but if is set to some values, led matrix will start to display the shape one pixel (In our case, one led) at a time by the interval amount set for delay variable.

You can find more examples under examples directory.

Connections

Connections for ESP8266 or ESP32, The pins can be changed while initiating the class.

Wemos D1 Mini max7219 8x8 LED Matrix
5V VCC
GND GND
D7 MOSI (GPIO13) DIN
D8 CS (GPIO15) CS
D5 SCK (GPIO14) CLK

For pyBoard

PyBoard max7219 8x8 LED Matrix
VIN VCC
GND GND
X8 MOSI DIN
X5 CS CS
X6 SCK CLK

Links