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

neopixels

v0.0.5

Published

Library to run a strand of neopixels from Tessel

Downloads

6

Readme

#Neopixels

Neopixels are strands of individually addressable RGB LEDs, made by Adafruit. Neopixels consist of individual WS2812B chips which are also sold by other vendors like SeeedStudio They're fantastic for creating light shows, art installations, mood lighting, and a ton of other applications.

This library is rather sparse at the moment and most of the functionality lies within a driver written in the firmware. It assumes a single strand of LEDs connected to pin G4 on the GPIO bank and RGB leds with a 800kHz signal.

##Installation

Make sure you have firmware build 0.1.16 or later (tessel board --version) installed on Tessel.

Then, install this library: npm install neopixels

Then connect the circuit. You'll need a separate power source because these LEDs require a lot of juice. Check out Adafruit's Powering Guide for the best advice. Best practice is to power the neopixels with 3.7V when using Tessel (since it is a 3.3V MCU) but 5V has worked fine in practice. Connect the data wire to G4 on Tessel's GPIO bank and connect GND on Tessel to both GND wires from the neopixels.

##Usage

Example:

// Import the neopixels library
var Neopixels = require('../');

// Make an instance of the strip
var neopixels = new Neopixels();

// When an animation completes
neopixels.on('end', function() {
  // Start the animation again
  neopixels.animate(100, Buffer.concat(tracer(100)));
});

/* 
* Start an animation!
* First argument is number of pixels per animation frame (usually the number of pixels in your strip)
* The second argument is the animation data
* The third optional argument is a callback on completion

* The library will automatically split the animation up
* into the appropriate number of animation frames
* based on the size of each frame (first argument)
*/
neopixels.animate(100, Buffer.concat(tracer(100)));


// An example animation
function tracer(numLEDs) {
  var trail = 5;
  var arr = new Array(numLEDs);
  for (var i = 0; i < numLEDs; i++) {
    var buf = new Buffer(numLEDs * 3);
    buf.fill(0);
    for (var col = 0; col < 3; col++){
      for (var k = 0; k < trail; k++) {
        buf[(3*(i+numLEDs*col/3)+col+1 +3*k)] = 0xFF*(trail-k)/trail;
      }
    }
    arr[i] = buf;
  }
  return arr;
}

##Contributions

This library could use a ton of help! If you're going to help, you'll need to get your hands dirty with some C in our firmware. Check out the firmware and you'll need to be able to compile your own firmware.

Email me at [email protected] if you're interested.

Things that need doing:

  • {EASY} Making it possible to configure to run with a 400kHz signal as well.
  • {EASY} Making it possible to configure which pwm pin (G4, G5, or G6) the data is output on.
  • {MEDIUM [Non-firmware]} Add more example animations to the node module.
  • {HARD} Enable 3x the frame rate by allowing 3 animations to be passed in and outputting animations on all 3 pwm pins (G4, G5, and G6 on the GPIO bank).