Interfacing with MAX7219 8x8 LED arrays for the Raspberry Pi over SPI
npm install max7219-matrix
The SPI device needs to be enabled on your Raspberry Pi. Sparkfun tutorial on how to do this
Check in /dev if the devices installed successfully:
$ ls -l /dev/spi*crw-rw---- 1 root spi 153, 0 Aug 14 22:22 /dev/spidev0.0crw-rw---- 1 root spi 153, 1 Aug 14 22:22 /dev/spidev0.1
How to use the package
let maxMatrix = ;let m = "/dev/spidev0.0" 4;m;
node example/demo.js to run the snippet from above
--- The demo is set for 4 LED Arrays.
- The displayed text will always be trimmed to the first N characters, where N is the number or screens specified in the constructor. ex.:
If we set the screen count to 4, and we send the text "APPLE" (
max7219.processText("APPLE");), our screen will display
- Creates an instance of the object, and initializes it with the required values.
deviceargument specifies the SPI Device to which the screens are connected. ex.:
screenCountargument specifies the number of daisy-chained MAX7219 driven 8x8 LED arrays ex.:
- Set the brightness of the matrices.
brightnessshould be between 0 and 15 (inclusive)
- Display the
text, in the selected
font. If the
fontis not specified, it defaults to
- The following fonts can be used:
- Syntax :
The demo, found at
example/demo.js, displays " TEST " in the SINCLAIR_FONT_ROTATED.
(it's set for 4 daisy-chained MAX7219 matrices)
- Text rotation
- Scrolling text
- "Breathing" text effect
- "Blinking" text effect
This is a project I work on in my spare time, and it's very much a work-in-progress. If you have any problems, open an issue on GitHub. Pull requests are very welcome! Any improvements made to the code are much appreciated.