Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jshirley
Created November 9, 2012 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jshirley/4046868 to your computer and use it in GitHub Desktop.
Save jshirley/4046868 to your computer and use it in GitHub Desktop.
Using Node + node-hid to control the Dream Cheeky USB LED Light on OS X
var HID = require('HID'),
path;
HID.devices().forEach( function(device) {
if ( device.product.match(/Dream Cheeky/) ) {
console.log(device);
path = device.path;
}
});
if ( path ) { console.log('Opening device with path ' + path);
var device = new HID.HID(path);
console.log(device);
// The initialization
var data1 = [ 0x1f, 0x02, 0x00, 0x2e, 0x00, 0x00, 0x2b, 0x03 ];
device.write(data1);
var data2 = [ 0x00, 0x02, 0x00, 0x2e, 0x00, 0x00, 0x2b, 0x04 ];
device.write(data2);
var data3 = [ 0x00, 0x02, 0x00, 0x2e, 0x00, 0x00, 0x2b, 0x05 ];
device.write(data3);
var red = 0xff, green = 0x00, blue = 0x00;
device.write([ red, green, blue, 0x00, 0x00, 0x00, 0x00, 0x05 ]);
// Now set a color
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment