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

heroic-pixel-pusher

v0.2.4

Published

Heroic Robotics' Pixel Pusher LED controller node js interface

Downloads

4

Readme

node-pixelpusher

Heroic Robotics' Pixel Pusher LED controller interface.

Install

npm install heroic-pixel-pusher

Using The Library :

Prepare To Push

var PixelPusher = require('heroic-pixel-pusher');

Discovering A PixelPusher On Your Network

new PixelPusher().on('discover', function(controller) {
    var timer = null;

    // log connection data on initial discovery
    console.log('-----------------------------------');
    console.log('Discovered PixelPusher on network: ');
    console.log(controller.params.pixelpusher);
    console.log('-----------------------------------');

    // capture the update message sent back from the pp controller
    controller.on('update', function() {
        console.log ({
            updatePeriod  : this.params.pixelpusher.updatePeriod,
            deltaSequence : this.params.pixelpusher.deltaSequence,
            powerTotal    : this.params.pixelpusher.powerTotal
        });
    }).on('timeout', function() {
        // be sure to handel the situation when the controller dissappears.
        // this could be due to power cycle or network conditions
        console.log('TIMEOUT : PixelPusher at address [' + controller.params.ipAddress + '] with MAC (' + controller.params.macAddress + ') has timed out. Awaiting re-discovery....');
        if (!!timer) clearInterval(timer);
    });

    //--
    // create a timer of some fps frequency and send the new pixel data
    //--

}).on('error', function(err) {
  console.log('PixelPusher Error: ' + err.message);
});

Pushing Pixels (push it real good!)

// aquire the number of strips that the controller has said it
// has connected via the pixel.rc config file
var NUM_STRIPS = controller.params.pixelpusher.numberStrips;

// aquire the number of pixels we that the controller reports is
// in each strip. This is set in the pixel.rc file placed on your thumb drive.
var PIXELS_PER_STRIP = controller.params.pixelpusher.pixelsPerStrip;

// create a loop that will send commands to the PP to update the strip
var UPDATE_FREQUENCY_MILLIS = 30;// 15 is just faster than 60 FPS

timer = setInterval(function() {
    // create an array to hold the data for all the strips at once
    // loop
    var strips = [];
    for (var stripId = 0; stripId< NUM_STRIPS; stripId ++){
        // set a random pixel blue
        s.getRandomPixel().setColor(0,0,255, 0.1);
        // render the strip data into the correct format for sending
        // to the pixel pusher controller
        var renderedStripData = s.getStripData();
        // add this data to our list of strip data to send
        strips.push(renderedStripData);
    }
    // inform the controller of the new strip frame
    controller.refresh(strips);
}, UPDATE_FREQUENCY_MILLIS);

LED Data Formats

// if you are using NeoPixels from Adafruit you wont need to
// use this.

if (strip[x].flags & 0x1) {
    // red, green blue, orange[3], white[3]

    // indicates that the actual number of pixels is pixelsPerStrip/3,
    // each pixel is encoded as 9 octets
    //     first three octets are R, G, and B
    //     next three octets is the orange value (three times)
    //     next three octets is the white  value (three times)

} else if (strip[x].flags & 0x2) { // wide pixels
    // indicates that the actual number of pixels is pixelsPerStrip/2,
    // each pixel is encoded as 6 octets: R >> 8, G >> 8, B >> 8, R & 0xff, G & 0xff, B & 0xff
} else {
    // each pixel is encoded as three octets: R, G, and B
    // this is how the library handles data by default.
}