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

node-blinkt

v1.2.1

Published

A Node.js Library to Interact With the Raspberry Pi Blinkt! LED Hat.

Downloads

28

Readme

node-blinkt

A Node.js Library to Interact with Blinkt

Install

npm install node-blinkt

Usage

var Blinkt = require('node-blinkt'),
	leds = new Blinkt();

leds.setup();
leds.clearAll();
leds.setAllPixels(0, 156, 0, 0.1);
leds.sendUpdate();

Methods

setup()

Connects to the GPIO and sets the GPIO pin modes. Must be called before any other commands.

setup(dat, clk)

Connects to an alternative set of GPIO pins and sets their modes. Can be called instead of the setup() function if you have wired blinkt up to alternative raspberry pi pins. The default values are 23 and 24 respectively.

clearAll()

Clears the pixel buffer. This is the same as setting all pixels to black. You must also call sendUpdate() if you want to turn Blinkt! off.

setPixel(pixelNum, red, green, blue, brightness)

Sets the specififed pixel to the passed rgb and brightness level. The pixelNum is an integer between 0 and 7 to indicate the pixel to change.

setBrightness(pixelNum, brightness)

Sets the brightness level between 0.0 (off) and 1.0 (full brightness) for the specified pixelNum. The pixelNum is an integer between 0 and 7 to indicate the pixel to change.

setAllPixels(red, green, blue, brightness)

Sets all pixels to the passed rgb and brightness level.

sendUpdate()

This method is the most important. You can set pixels colours as much as you want but they will not update until you call this method.

Using alternative IoT.js runtime

IoT.js is an alternate JavaScript runtime powered by JerryScript engine targeting more constrained devices.

First you need to install iotjs from source or precompiled package:

  • https://iotjs.net
  • https://github.com/rzr/webthing-iotjs/wiki/IotJs
  • https://libraries.io/npm/wiringpi-iotjs

Usage:

git clone --depth 1 https://github.com/Irrelon/node-blinkt ; cd node-blinkt
make start

iotjs-wiringpi

Development

Only modify files in the ./src folder. The ./dist folder is generated from the ./src folder via babel to produce an ES5 version.

You can modify the ./src/Blinkt.js file but please ensure you correctly document the functions you make using JSDoc. Run "npm run eslint" to check your code for errors before committing and fix all issues. You can also run "npm run eslint-fix" to auto-fix most common issues before fixing manual ones.

Once you are ready to commit an update, run "npm run build" which will generate a new ES5 build. Make sure you update the package.json version as well.

Thanks!

Copyright and License

All works are copyright Irrelon Software Limited. You may use this project under any license that you wish e.g. (MIT, GPL etc). You may use this software, source code, project, part of or in entirety for any reason under any license you wish, or no license at all. The software is given away freely and may be used for non-commercial and commercial, educational, governmental or any other purpose free of charge and free of license. Just go use it!