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. (Read more about the I2C communication protocol here.)
The module supports both 3.3V and 5V. It works better at 5V, but will need an external power source. (Read more about power on Tessel here.)
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
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);
});
Licensing
MIT
Copyright
Binary Noggin, LLC - 2015
Comments
Please log in or sign up to comment.