Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@mrdrogdrog/rpi-rgb-led-matrix

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mrdrogdrog/rpi-rgb-led-matrix

control led matrix with nodejs on raspberry pi. Nodejs binding of https://github.com/hzeller/rpi-rgb-led-matrix

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

rpi-rgb-led-matrix

Pilot your rgb led matrix with Nodejs on Raspberry Pi ! Nodejs binding of rpi-rgb-led-matrix library https://github.com/hzeller/rpi-rgb-led-matrix

Fork of: https://github.com/easybotics/node-rpi-rgb-led-matrix

Actively being maintained and modified for: https://github.com/mrdrogdrog/node-red-contrib-led-matrix

It is binding recent version of rpi-rgb-led-matrix library.

Installation with npm

$ npm i @mrdrogdrog/rpi-rgb-led-matrix

Installation with git

$ git clone --recursive https://github.com/mrdrogdrog/node-rpi-rgb-led-matrix.git
$ cd node-rpi-rgb-led-matrix
$ npm i

Get some Fun

var LedMatrix = require("easybotics-rpi-rgb-led-matrix");

//init a 16 rows  by 16 cols led matrix 
//default hardware mapping is 'regular', could be 'adafruit-hat-pwm' ect 
var matrix = new LedMatrix(16, 16 );
matrix.fill(255, 50, 100);
matrix.setPixel(0, 0, 0, 50, 255);
matrix.update();

The API has changed somewhat since the zeitungen version

LedMatrix API

All operations modify a local frame buffer, only after calling 'Update' are they printed to the display

  • Constructor: LedMatrix (rows, cols, parallelDisplays, chainedDisplays, brightness, hardware-mapping, rgbSequence, cliFlags)
	rows: height of led panels in pixels
	cols: width of led panels in pixels
	parallelDisplays: number of parallel panels
	chainedDisplays: number of chained panels
	brightness: initial brightness 0 - 100
	hardware-mapping: 'regular', 'adafruit-hat' etc
	rgbSequence: default 'RGB'
	cliFlags: array of cli flags
  • brightness (value)
	set brightness between 0 - 100
  • clear ()
	clear the display buffer
  • drawCircle (x, y, radius, r, g, b)
	draw colored circle to the buffer
  • drawLine (x0, y0, x1, y1, r, g, b)
	draw colored line to the buffer
  • drawText (x, y, text, font, r, g, b)
	draw colored text to the buffer
	to use the fonts that come with the repo it looks something like this

	const input = "hello world!"; //whever you get the input from
	const font  =  __dirname + '/fonts/' + "5x8.bdf";
	led.drawText(x, y, input, font, r, g, b);
	led.update();
  • fill (r, g, b)
	fill the buffer with a color
  • getHeight ()
	get height of addressable space
  • getWidth ()
	get width of addressable space
scroll
setImageBuffer
mysterious methods back from before we picked up this library 
  • setPixel (x, y, r, g, b)
	set pixel to a color
  • update ()
	Draw the current buffer to the display (with vsync!)

Keywords

raspberry

FAQs

Package last updated on 28 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts