node-myo-edison
v1.0.0
Published
Myo BLE interface
Downloads
1
Readme
node-myo-edison
Control Myo Armband with node.js on your Intel Edison Board
Intel Edison Instructions
Instructions are availabe on instructables : http://www.instructables.com/id/MyoCraft-Myo-Armband-with-nodejs-on-Intel-Edison-B/
Prerequisites
Install noble see : https://github.com/sandeepmistry/noble
Usage
var myo = require('./myo.js');
CONNECT
Quick Connect
myo.quickConnect(function(err, id){
console.log('myo unique id : ', id);
});
Classic Connect
myo.scan.start(function(err, data){
console.log(err, data);
});
myo.event.on('ready', function(id){
console.log('myo unique id : ', id);
});
DISCONNECT
myo.connected[id]..disconnect();
INITIATE
Initiate Myo to receive stream and data
myo.connected[id].unlock("hold", function() {
// lock - time (will lock after inactivity) - hold
myo.connected[id].sleepMode("forever", function () {
// normal - forever (never sleep)
myo.connected[id].setMode('send', 'all', 'enabled', function () {
// emg : none - send - raw
// imu : none - data - events - all - raw
// classifier : enabled - disabled
console.log('initiated');
});
});
});
INTERACTION
Get Name
myo.connected[id].generic.getName(function (err, data){ // Get device name
console.log(err, data);
});
Set Name
myo.connected[id].generic.setName('Myo NAME', function (err, data){ // Set device name
console.log(err, data);
});
Battery Info
myo.connected[id].battery(function(err, data) {
console.log("battery : " + data + " %"); // data => battery in percent
});
Vibrate Classic
myo.connected[id].vibrate("strong"); // light, medium, strong
Vibrate Custom
myo.connected[id].vibrate2(1500, 255); // time in milliseconds, power 0 - 255
Vibrate Notify
myo.connected[id].notify(); // notify : short and light vibration
Deep Sleep
myo.connected[id].deepSleep(function(){}); // go into deep sleep
Basic Info
myo.connected[id].info(function(err, data){
console.log(err, data);
});
Firmware Info
myo.connected[id].firmware(function(err, data){
console.log(err, data);
});
STREAM
Set "true" to get stream on events or "false" to disable.
IMU
myo.connected[id].imu(true);
Classifier
myo.connected[id].classifier(true);
EMG
myo.connected[id].emg(true);
EVENTS
myo.event.on('discover', function(id){
console.log('discover', id);
});
myo.event.on('connect', function(id){
console.log('connect', id);
});
myo.event.on('disconnect', function(id){
console.log('disconnect', id);
});
myo.event.on('ready', function(id){
console.log('peripheral ready :', id);
});
myo.event.on('imu', function(data){
console.log('imu', data);
});
myo.event.on('classifier', function(data){
console.log('classifier', data);
});
myo.event.on('emg4', function(data){
console.log('emg', data);
});