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

hzeller-matrix

v1.0.85

Published

Raspberry Pi RGB Matrix addon for Node

Downloads

32

Readme

Hzeller Matrix

A module for generating animations on a Raspberry PI. Before you install this, please read this https://github.com/hzeller/rpi-rgb-led-matrix.

An example of using this module is available here https://github.com/meg768/hzeller-matrix-example.

Installation

$ npm install hzeller-matrix --save

Before you install, make sure you have GraphicsMagick installed on the Pi, and some other stuff.

$ sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install libwebp-dev
$ sudo aptitude update && sudo aptitude install libgraphicsmagick++1-dev

Usage

var Matrix = require('hzeller-matrix');
var matrix = new Matrix({width:32, height:32});

matrix.runText('Hello World');

Note (2016-07-28)

This has been working fine on a Raspberry Pi 2. But I have not been able to get a stable image/animation using a Raspberry Pi 3. It might be my long cables. Just a heads up.

Constructor

new Matrix(config)

Constructs a new matrix object. The config argument must contain the following values.

  • width - Specifies the width of the display.
  • height - Specifies the height of the display.
  • hardware - Set to 'none' to just log to console.

If config is not specified all methods will only log to console and no hardware is accessed.

Example

var Matrix = require('hzeller-matrix');
var matrix = new Matrix({width:32, height:32})
...

Methods

matrix.runText(text, options, callback)

This method displays scrolling text. The callback argument is called when the animation completes. The options argument may have the following values.

  • textColor - Changes text color. Default is red.
  • fontName - Use the specified TrueType font.
  • fontSize - Change the font size.
  • duration - Run no longer this number of seconds. Default is -1, that is until the text is fully displayed.
  • delay - Scroll delay in milliseconds.
  • speed - Speed factor. Default 1.0. Lesser value slows down the animation. Greater value speeds it up.
  • iterations - Number of iterations to display the text. Default is 1. -1 == infinity.

Example

matrix.runText('Hello World', {textColor: 'blue', fontSize:30});

matrix.runImage(image, options, callback)

Display an image. The image parameter may be a string representing the file name or a JavaScript Buffer object. The callback argument is called when the animation completes. The options argument may have the following values.

  • scroll - Specifies the direction to scroll the image. Valid values are 'left', 'right', 'up', 'down' or 'auto'. Default is 'auto'.
  • pause - Specifies the time, in seconds, to pause after scroll has finished.
  • duration - Number of seconds to animate. Default is 60 seconds.
  • delay - Animation delay during display loop in milliseconds.
  • iterations - Number of iterations to display the image. -1 == infinity.
  • speed - Speed factor. Default 1.0. Lesser value slows down the animation. Greater value speeds it up.

matrix.runAmination(gifFile, options, callback)

Runs an animated GIF, frame by frame. The callback argument is called when the animation completes. The options argument may have the following values.

  • duration - Number of seconds to animate. Default is 60 seconds.
  • delay - Animation frame delay i milliseconds if the value is missing in the GIF.
  • speed - Speed factor. Default 1.0. Lesser value slows down the animation. Greater value speeds it up.
  • iterations - Number of iterations to animate. Default is -1, that is infinite.

matrix.runRain(options, callback)

Displays a Matrix-like rain animation. The options are as follows. The callback argument is called when the animation completes. The options argument may have the following values.

  • hue - Specifies the hue of the rain. If not specified, it will use the time of day to specify the hue.
  • duration - Run the animation for duration seconds. -1 == inifinity.
  • delay - Animation delay during display loop in milliseconds.
  • speed - Speed factor. Default 1.0. Lesser value slows down the animation. Greater value speeds it up.

matrix.runPerlin(options, callback)

Runs a perlin animation. The callback argument is called when the animation completes. The options argument may have the following values.

  • mode - Valid modes are 1, 2 or 3.
  • duration - Run the animation for duration seconds. -1 == inifinity.
  • delay - Animation delay during display loop in milliseconds.
  • speed - Speed factor. Default 1.0. Lesser value slows down the animation. Greater value speeds it up.

matrix.runClock(image, options, callback)

Displays a clock with the specified look. See https://github.com/meg768/hzeller-matrix-example for examples of clock images.

The callback argument is called when the animation completes. The options argument may have the following values.

  • duration - Run the animation for duration seconds. -1 == inifinity.

matrix.isRunning()

Returns true/false if an animation is running or not.

Properties

matrix.width

Returns the matrix width.

matrix.height

Returns the matrix height.

See also

Check out https://github.com/meg768/hzeller-matrix-example for more information.

Build Instructions

Instructions how to se up and compile hzeller-matrix as of 2016-07-27.

Install Raspbian image.

Install image 2016-05-27-raspbian-jessie-lite.img. For the Mac, use Pi Filler.

Find out the IP-address of the Raspberry

For the Mac, use Lan Scan or Lan Scan Pro. Google it.

Connect to the Pi

Start a Terminal session and use ssh to connect. When prompted, the password is raspberry.

$ ssh [email protected]

Expand File System

Once connected, start raspi-config and select Expand File System. You may want to change the time zone as well.

$ sudo raspi-config
$ sudo reboot

Update apt-get

$ sudo apt-get update && sudo apt-get dist-upgrade

Install node

$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Install GraphicsMagick++

$ sudo aptitude update && sudo aptitude install libgraphicsmagick++1-dev

Install some more stuff

$ sudo apt-get install git libwebp-dev

Download hzeller-matrix

$ git clone https://github.com/meg768/hzeller-matrix.git

Build it

$ cd hzeller-matrix
$ npm install

Configure Wi-Fi

Edit the configuration file.

$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

And add this at the end.

network={
	ssid="my-network-name"
	psk="my-password"
}

Save and reboot. Connect again using the same ip-address as before and find out the wlan ip-address by running the following.

$ ifconfig

Now you can disconnect the network cable and log on to this new ip-address in the future.