Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including 8x8matrix with all npm packages installed. Try it out:

var _8x8matrix = require("8x8matrix")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

8x8matrix v0.1.4

A simple node.js-based helper for the Raspberry Pi and the Adafruit 8x8 Matrix

Adafruit 8x8-Matrix with NodeJS

Control your Adafruit 8x8 Matrix with NodeJS. Your nodejs script have to run as root.

Setup

$ npm i 8x8matrix
const Matrix = require('8x8matrix');

let matrix = new Matrix();
matrix.writeArray(matrix.smily);

Options

let matrix = new Matrix({
    brightness: 15,
    slaveAddress: 0x70,
    bautrate: 10000
});

API

Pixels can be written by a simple js-array with 64 objects.

var smily = [
    0,0,1,1,1,1,0,0,
    0,1,0,0,0,0,1,0,
    1,0,1,0,1,0,0,1,
    1,0,1,0,1,0,0,1,
    1,0,0,0,0,1,0,1,
    1,0,1,1,1,0,0,1,
    0,1,0,0,0,0,1,0,
    0,0,1,1,1,1,0,0
];

matrix.writeArray(smily);

/**
  * Set brightness of all LED
  * Values: 1 (very low) to 15 (very bright)
  */

matrix.setBrightness(8);

/**
  * Set first top-left LED to on
  * matrix.setLED(x, y, true/false);
  */

matrix.setLED(0, 0, 1);

Test

$ sudo node test.js

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free