Need private packages and team management tools?Check out npm Teams »

rgbledbar

1.0.0 • Public • Published

Touch Key

NodeJS RGB LED Bar lib for the TLC59116.

Allows one to attach RGB LED's to the TLC.

Dependencies

This library makes use of:

  • tlc59116 a driver library to interact with the tlc59116
  • i2c-bus to communicate with i2c devices

Example

The i2c object needs to be injected via the constructor.

A basic example:

const RGBLedBar = require('rgbledbar')
const i2c = require('i2c-bus');
 
const i2c1 = i2c.open(1, (err) => {
  if (err) throw err;
  console.log("Opened i2c bus successfully");
 
  let ledbar = new RGBLedBar(i2c1);
 
  ledbar.set_led(0, {red: 100, green: 0, blue: 0});
  ledbar.set_led(1, {red: 0, green: 100, blue: 0});
  ledbar.set_led(2, {red: 0, green: 0, blue: 100});
  
  setTimeout(() => {
    ledbar.all_off();
  }, 1000);
 
});

RGBLedBaris also compatible with color.

For example:

const RGBLedBar = require('rgbledbar')
const i2c = require('i2c-bus');
const Color = require('color');
 
const i2c1 = i2c.open(1, (err) => {
  if (err) throw err;
  console.log("Opened i2c bus successfully");
 
  let ledbar = new RGBLedBar(i2c1);
 
  ledbar.set_led(0, Color.rgb(100, 0, 0));
  ledbar.set_led(1, Color('#00FF00'));
  ledbar.set_led(2, Color('#0000FF').lighten(0.1));
  
  setTimeout(() => {
    ledbar.all_off();
  }, 1000);
 
});

Install

npm i rgbledbar

DownloadsWeekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.27 kB

Total Files

6

Last publish

Collaborators

  • avatar