big-red-button-node-hid-2
Version:
A node-hid based driver to read the Dream Cheeky Big Red Button from node.js.
28 lines (19 loc) • 674 B
JavaScript
// MIT licensed. (C) Dj Walker-Morgan 2013
var BigRedButton = require('./BigRedButton');
var bigRedButton;
for (var i = 0; i < BigRedButton.deviceCount(); i++) {
console.log('opening BigRedButton', i);
bigRedButton = new BigRedButton.BigRedButton(i);
bigRedButton.on('buttonPressed', function () {
console.log('button pressed');
});
bigRedButton.on('buttonReleased', function () {
console.log('button released');
});
bigRedButton.on('lidRaised', function () {
console.log('lid raised');
});
bigRedButton.on('lidClosed', function () {
console.log('lid closed');
});
}