npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

max7219-matrix

v0.2.0

Published

Interfacing with MAX7219 8x8 LED arrays for the Raspberry Pi

Downloads

14

Readme

MAX7219-Matrix

NpmVersion GitHub issues npm GitHub

Interfacing with MAX7219 8x8 LED arrays for the Raspberry Pi over SPI


Install

npm install max7219-matrix


Dependencies

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.0
crw-rw---- 1 root spi 153, 1 Aug 14 22:22 /dev/spidev0.1

Wiring

alt text


How to use the package

let maxMatrix = require("max7219-matrix");

let m = new maxMatrix.MAX7219Matrix("/dev/spidev0.0", 4);
m.processText("TEST");

Run 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 APPL.

maxMatrix.MAX7219Matrix(device, screenCount)

  • Constructor
  • Creates an instance of the object, and initializes it with the required values.
  • The device argument specifies the SPI Device to which the screens are connected. ex.: "/dev/spidev0.0".
  • The screenCount argument specifies the number of daisy-chained MAX7219 driven 8x8 LED arrays ex.: 4.

setBrightness(brightness)

  • Set the brightness of the matrices.
  • brightness should be between 0 and 15 (inclusive)

processText(text, font)

  • Display the text, in the selected font. If the font is not specified, it defaults to CP437_FONT.
  • The following fonts can be used:
  • CP437_FONT, SINCLAIR_FONT, LCD_FONT, UKR_FONT, TINY_FONT, CP437_FONT_ROTATED (default), SINCLAIR_FONT_ROTATED and LCD_FONT_ROTATED.
  • Syntax :
m.processText("TEST", "SINCLAIR_FONT_ROTATED");

Example

The demo, found at example/demo.js, displays " TEST " in the SINCLAIR_FONT_ROTATED. (it's set for 4 daisy-chained MAX7219 matrices)


TO-DOs

  • Text rotation
  • Scrolling text
  • "Breathing" text effect
  • "Blinking" text effect

Notes

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.


Special thanks to