Last active
August 29, 2015 13:57
-
-
Save kurtisnelson/9770574 to your computer and use it in GitHub Desktop.
[wearscript] Control your Glass with Myo, Pebble, or Magnets
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("ready"); | |
WS.pebbleSetBody('connected!', false); | |
// Currently one of {NONE, FIST, FINGERS_SPREAD, WAVE_IN, WAVE_OUT} | |
WS.gestureCallback('onMyo', function (x) { | |
if(x == "WAVE_IN"){ | |
WS.control("SWIPE_LEFT"); | |
}else if(x == "WAVE_OUT"){ | |
WS.control("SWIPE_RIGHT"); | |
}else if(x == "FIST"){ | |
WS.control("TAP"); | |
}else if(x == "FINGERS_SPREAD"){ | |
WS.control("SWIPE_DOWN"); | |
} | |
}); | |
WS.gestureCallback('onPebbleSingleClick', function (name) { | |
WS.pebbleSetTitle(name + ' clicked', false); | |
if(name == "up"){ | |
WS.control("SWIPE_RIGHT"); | |
}else if(name == "down"){ | |
WS.control("SWIPE_LEFT"); | |
}else if(name == "select"){ | |
WS.control("TAP"); | |
} | |
}); | |
WS.gestureCallback('onPebbleLongClick', function (name) { | |
WS.pebbleVibe(2); | |
WS.control("SWIPE_DOWN"); | |
}); | |
} | |
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": "FancyControls"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment