🤯 50% Off! 700+ courses, assessments, and books

Blink(1), a Programmable Indicator for All Developer Needs

Chris Ward
Share

Late last summer someone handed me a curious USB device that I popped in my bag and then sat on my shelf until today when I thought it was about time I plugged it into my computer to see what it did.

That device was the Blink(1), a fully open source USB powered indicator light that is highly programmable and customizable to suit just about any need you might have for a… USB powered indicator light.

As niche as a device as this may sound, it claims users at companies such as Pixar, Microsoft, Sharp, Twitter, Google and other large companies.

Getting Started

The problem with a hardware device is that you need to get your hands on one. The Blink is affordable (Less than 30 dollars or euros) and easy to find. If you like what you read here maybe you’ll get one for yourself, or wonder why on earth you may care about a programmable light.

Software

All of Blink’s software is free and open source and you can download a Mac and Windows GUI, a CLI tool and a myriad of Libraries and SDKs, some of which we’ll cover here.

The GUI application gives a lot of control over the Blink and will cover a lot of use cases you might have.

Blink Control App

From left to right the main tabs allow configuration for:

  • Start: Quick access to enabling and disabling the blink’s default patterns.
  • IFTTT: Reacting to IFTTT recipes, which we’ll cover next.
  • Tools: Adding scripts or URLs of scripts that can control the Blink.
  • Mail: Checking email accounts to trigger light patterns.
  • Hardware: Reacting to battery, CPU and RAM changes on your local machine.

Many of the elements of the Blink Control app are reasonably self-explanatory and work well, but as is typical with Kickstarter / Open Source projects, I found a issues here and there (most crucially, if the GUI is open, the CLI tool wont work), but nothing a developer wont be able to work through.

Quick Test

Let’s try setting up one of the most flexible and potentially useful sections and set up an IFFTTT integration to flash when a GitHub issue is assigned to us.

First we need the Blink’s IFFTTT key, found on the left hand side of the control application.

IFFT Key

Next, find and set-up the IFFTTT recipe that connects GitHub to Blink, adding your IFFTTT key when promoted. Make sure you name it something machine-readable as we will need this later, i.e.

Rule Name

Now add a matching IFFTTT rule in the Blink Control application, naming it the same as the rule and setting a light pattern of your choosing.

Blink IFFT Rule

Next create an issue, assign it yourself, wait for IFFTTT and the Blink to communicate and you should see:

Blink Flashing Red

Hacking Blink

The Blink Control app allows us to do a lot, but is most useful when combined directly with an application flow and this is where the Blink excels.

The Blink has client libraries for Java, Node.JS, Python, Go, QT, C, .Net, Ruby, Command Line and REST API, so offers possibilities for connecting with almost any application you might care to connect to.

One obvious use case is for status updates from continuous integration systems and there are pre-exisiting libraries for Travis, GitLab and TeamCity with any other build tool supportable via writing a language specific plugin or using REST.

Controlling the Blink is a case or telling it to turn on or off and what pattern of colors to display. If you are using a client library or the REST interface, the principles are the same.

For example, tell the Blink to flash with one of the default preset patterns:

curl 'http://localhost:8934/blink1/pattern/play?pname=policecar'

And stop the specific pattern flashing:

curl 'http://localhost:8934/blink1/pattern/stop?pname=policecar'

Create and play a custom pattern called ‘sitepoint’ that alternates the SitePoint Logo colors five times:

curl 'http://localhost:8934/blink1/pattern/add?pname=sitepoint&pattern=5,%23f9a140,0.5,%23208ab1,0.5'

curl 'http://localhost:8934/blink1/pattern/stop?pname=sitepoint'

Read more about what’s possible with the interface here.

Seeing the Light?

As you can see, the Blink just does one thing, but the possibilities and means for making it do that one thing are almost endless. If you have a use for such a device, you likely are already convinced. If you don’t have a practical use, the Blink may be a great visual tool for learning to program as the instant feedback is satisfying.

I’d love to hear what you would do with a Blink, I’m off to write a script to notify me when this article receives a comment.

CSS Master, 3rd Edition