backpack-ht16k33

0.4.0 • Public • Published

Backpack-HT16K33

Driver for the HT16K33 backpack from Adafruit The documentation for the chip can be found here.

If you run into any issues please create a ticket.

Setup

The backpack has four connections +, -, D, and C. They need to be hooked to 3.3V, GND, SDA, and SCL, respectively, of a module port. The module supports both 3.3V and 5V. It works better at 5V, but will need an external power source.

Installation

npm install backpack-ht16k33

Example

var tessel = require("tessel");
var backpack = require('backpack-ht16k33').use(tessel.port['A']);
 
backpack.on('ready', function() {
  backpack.clear();
  var bitmap = [
    [0,0,1,1,1,1,0,0],
    [0,1,0,0,0,0,1,0],
    [1,0,1,0,0,1,0,1],
    [1,0,0,0,0,0,0,1],
    [1,0,1,0,0,1,0,1],
    [1,0,0,1,1,0,0,1],
    [0,1,0,0,0,0,1,0],
    [0,0,1,1,1,1,0,0],
  ];
  backpack.writeBitmap(bitmap);
});
 

Methods

# backpack.clear ( callback(err) ) turns off every light on the led

# backpack.writeBitmap ( bitmap, callback(err) ) the bitmap is and array of bits. Each 1 will be turned on and the 0 will be turned off.

# backpack.animate ( frames, interval ) renders each frame in order with a separation in ms equal to the interval

# backpack.scroll ( bitmap, interval ) scrolls the bitmap horizontally with a separation between frames in ms equal to the interval. Bitmap can be any width

# backpack.scrollText ( text, interval ) scrolls the text horizontally with a separation between frames in ms equal to the interval. Text can be any lenght

Events

# backpack.on( 'error', callback(err) ) Emitted upon error.

# backpack.on( 'ready', callback() ) Emitted upon first successful communication between the Tessel and the module.

Further Examples

var tessel = require("tessel");
var backpack = require('../').use(tessel.port['A']);
 
backpack.on('ready', function() {
  backpack.clear();
  var smile = [
    [0,0,1,1,1,1,0,0],
    [0,1,0,0,0,0,1,0],
    [1,0,1,0,0,1,0,1],
    [1,0,0,0,0,0,0,1],
    [1,0,1,0,0,1,0,1],
    [1,0,0,1,1,0,0,1],
    [0,1,0,0,0,0,1,0],
    [0,0,1,1,1,1,0,0],
  ];
 
  var straight = [
    [0,0,1,1,1,1,0,0],
    [0,1,0,0,0,0,1,0],
    [1,0,1,0,0,1,0,1],
    [1,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,1],
    [1,0,1,1,1,1,0,1],
    [0,1,0,0,0,0,1,0],
    [0,0,1,1,1,1,0,0],
  ];
 
  var frown = [
    [0,0,1,1,1,1,0,0],
    [0,1,0,0,0,0,1,0],
    [1,0,1,0,0,1,0,1],
    [1,0,0,0,0,0,0,1],
    [1,0,0,1,1,0,0,1],
    [1,0,1,0,0,1,0,1],
    [0,1,0,0,0,0,1,0],
    [0,0,1,1,1,1,0,0],
  ];
 
  var frames = [smile, straight, frown];
  backpack.animate(frames, 500);
});
 

Hardware specifications and Advanced Information

Licensing

MIT

Copyright

Binary Noggin, LLC - 2015

Dependents (0)

Package Sidebar

Install

npm i backpack-ht16k33

Weekly Downloads

1

Version

0.4.0

License

MIT

Last publish

Collaborators

  • adkron