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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ros2jsguy/node-blink1-async

v0.1.6

Published

Asynchronous TypeScript api for the node-blink1 package

Readme

node-blink1-async

Programmatically controlling blink(1) USB LED devices is simple using node-blink1-async. Much of the API is asynchronous (i.e., returns Promise that you can await on) and fully documented. This module has been tested on Mac, Windows 10, and Ubuntu Linux on a Raspberry Pi 4.

blink(1) USB led on raspberry pi 4

If you perfer a JS callback style API consider node-blink1.

Prerequisites

  • Node (v12+)
  • blink(1) USB led device

Ensure your blink(1) is fully functional using the blink(1) utilities.

Install

npm install https://github.com/ros2jsguy/node-blink-async

Linux Users

Your device may need libusb installed:

sudo apt install libusb-1.0-0

See node-hid's instructions for compiling from source You may find the 51-blink1.rules file useful in your device configuration process.

TypeScript Example

import {Blink1, Blink1_LEDN, BlinkRate} from '@ros2jsguy/node-blink1-async';

async function example() {
  // list all blink(1) devices
  console.log('devices; ', Blink1.devices());

  // output the version info of the default blink(1) device
  let blink1: Blink1 = new Blink1();
  console.log("version: " , await blink1.version() );

  console.log('set color: red', await blink1.setRGB(255));
  console.log('read rgb: ', await blink1.rgb(Blink1_LEDN.LEDA));
  await Blink1.delay(2000);

  console.log('Blink green at VERY_FAST rate (100 ms) for 5 seconds');
  await blink1.blink(0, 255, 0, BlinkRate.VERY_FAST);
  await Blink1.delay(5000);
  
  console.log('Blink blue at SLOW rate (1000 ms) for 5 seconds');
  await blink1.blink(0, 0, 255, BlinkRate.SLOW);
  await Blink1.delay(5000);

  console.log('Show solid yellow for 5 seconds');
  await blink1.blink(255, 255, 0);
  await Blink1.delay(5000);

  // turn off the blink(1) output
  await blink1.off();

  // access the display pattern at line-1
  console.log('Color pattern (line-1):', await blink1.readPatternLine(1));

  // clear the memory of all display patterns.
  console.log('Clearing pattern');
  await blink1.clearPattern();

  // confirm that display patterns are cleared
  console.log('Color pattern (line-1):', await blink1.readPatternLine(1));

  // close and release the blink(1) device
  await blink1.close();

  console.log('completed');
}

Developer Notes

I develop mostly in TypeScript and prefer using modern JS features when I have the option. Working directly with the node-blink1 package which has been around for awhile, felt too retro for my liking, e.g., no jsdoc, callback-based api... I mean no disrespect to the node-blink1 author(s) who's priority for backward compatibility supercedes breaking the package just to use a new wizbang language feature. While developing a robot using TypeScript on a Raspi4 I wanted to integrate an old Blink1 led from my kit into the design. That led me to creating this package that makes it easier to to asynchronously control a Blink1 LED from TypeScript.

Credits

This package uses the node-blink1 package to perform the low level control of Blink1 devices