Skip to content

Instantly share code, notes, and snippets.

@connerbrooks
Created March 24, 2014 23:40
[wearscript] Myo Setup
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function server() {
//WS.myoTrain();
WS.say("myo stuff");
// Currently one of {NONE, FIST, FINGERS_SPREAD, WAVE_IN, WAVE_OUT}
WS.subscribe('myoEvent', function (chan, data) {
switch(data) {
case 'FINGERS_SPREAD':
WSRAW.control('SWIPE_DOWN', true);
break;
case 'FIST':
WSRAW.control('TAP', true);
break;
case 'WAVE_IN':
WSRAW.control('SWIPE_LEFT', true);
break;
case 'WAVE_OUT':
WSRAW.control('SWIPE_RIGHT', true);
break;
}
});
WS.gestureCallback('onMyo', function (x) {
WS.publish('myoEvent', x);
WS.log(x);
});
}
function main() {
if (WS.scriptVersion(1)) return;
WS.serverConnect('{{WSUrl}}', server);
}
window.onload = main;
</script></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment