This module is implemented using noble to connect to Myo, providing a general interface for accessing Myo. You do not need the Myo dongle to use this but you do need a working BT 4.0 dongle/device to work. I tested it using my laptop(Lenovo X230) which comes with BT 4.0 and it works fine.
A Websocket interface is also implemented trying to mimic the behavior of Myo Connect.
First, because noble is used please look at it's build requirement.
Mainly, you'll need to install bluetooth, bluez-utils and libbluetooth-dev
packages in your system.
I haven't publish this on npm yet so after making sure you have the necessary libraries and header files, just clone this project and install the modules:
git clone https://github.com/freehaha/myo4l.git
cd myo4l
npm install
npm run build # to generate the js files
Normally the scanning requires root privileges but you can grant the hci-ble
binary with permission by using this command
in the project root or in node_modules
:
find -path '*noble*Release/hci-ble' -exec sudo setcap cap_net_raw+eip '{}' \;
Otherwise you'll have to run your scripts as root all the time.
to setup websocket interface, run the ws.js
script with your myo device name as argument. It currently supporting only one device.
node ws.js <Myo name>
# for example
node ws.js Myo1
the WS interface specification can be found on Myo Developer Forum. I've tested this using Myo.js and it works fine but this is still an PoC-level implementation so feel free to fire bug reports or send PRs.
A simple example to use the library without WS interface can be found in the example folder but you can find almost
all possible usage in ws.coffee
so it'd be a good place to dig into.
I studied the myo-raw project and dig around the Android-SDK to find out most of the constants and steps to setup a connection with Myo and I hold no responsibility if using this library damages your devices in any way.