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

rpi-ws281x-node

v1.0.2

Published

Node API wrapper for the rpi_ws281x library.

Downloads

65

Readme

rpi-ws281x-node

Node API wrapper for the rpi_ws281x library.

Compilation

This project can be compiled using node-gyp.

$ npm install -g node-gyp
$ git clone https://github.com/dsyomichev/rpi-ws281x-node.git && cd rpi-ws281x-node
$ node-gyp configure && node-gyp build

However, it is recommended to install through npm.

Installation

You can add this package to your own project using npm.

$ npm install rpi-ws281x-node

Then load it into your own project. This project includes type declarations for Typescript.

const driver = require('rpi-ws281x-node');

Notes

  • This project is intended to be compiled on a Raspberry Pi device. On unsupported platforms, an empty interface is returned.

  • Root priveledges are required to acces PWM channels. Start the process as sudo.

Usage

The purpose of this project is to provide an interface between a node process and the rpi_ws281x driver. The configuration of this interface matches that of the parent library. Each property is provided via getter and/or setter, with the exception of the leds property of ws2811_channel.

driver.freq = 800000; // uint32_t;
driver.dmanum = 10; // int32_t

driver.channel[0].gpionum = 18; // int32_t
driver.channel[0].invert = 0; // int32_t
driver.channel[0].count = 100; // int32_t
driver.channel[0].strip_type = 0x00081000; // int32_t
driver.channel[0].brightness = 255; // uint8_t

driver.init();

These values will be checked through the setter to verify their validity for that particular parameter.

LEDs can be modified through the leds property. When the render method is called, the underlying buffers are copied to the driver.

driver.channel[0].leds = new UInt32Array(driver.channel[0].count).fill(0xffffff);
driver.channel[0].leds[0] = 0x000000;

driver.render();

The leds property will be checked for validity when the render method is called. It will throw an ERR_INVALID_ARG error if the property is not a Uint32Array or if the size does not match.

For more information on the structure of the driver, see index.d.ts and the usage section of the rpi_ws281x README.

Tested Devices

  • Raspberry Pi 3b v1.2

License

This project is licensed under the MIT License - see the LICENSE.md file for details.