0.2.0 • Published 8 years ago

blync-core v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

blync-core

JavaScript Library for interacting with Embrava's Blynclight Standard.

Usage

Get a reference to the BlyncLight attached to your computer:

const blyncCore = require('blync-core');
const blyncLight = blyncCore.findAllBlyncLights()[0];

The blyncLight reference above has a method named setColor.

This method works with values like #f00 or #ff00cc or with CSS color names like indigo or MediumSeaGreen.

blyncLight.setColor('indigo');

The setColor function returns a promise, and so you can call then() on the result:

// Red for a second, then blue for a second, then off.
blyncLight.setColor('red');
  .then(function() {
    setTimeout(function() {
      blyncLight.setColor('blue');
      setTimeout(function() {
        blyncLight.turnOff();
      }, 1000);
    }, 1000);
  })

The BlyncLight has a built in "blink" capability, and you can provide values of none, slow, or fast when setting a color:

// Flash blue for 5 seconds
blyncLight.setColor({
  color: 'blue',
  blink: 'slow'
});

When you are done, you can turn it off:

blyncLight.turnOff();

Further Reading

Circle CI Travis

An overview of blync-core.