Created
March 24, 2014 23:40
[wearscript] Myo Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":""} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment