Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bwhite
Forked from connerbrooks/glass.html
Created March 24, 2014 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwhite/9732959 to your computer and use it in GitHub Desktop.
Save bwhite/9732959 to your computer and use it in GitHub Desktop.
[wearscript] Pebble Example
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.pebbleSetBody('connected!', false);
WS.sensorOn(WS.sensor("pebbleAccelerometer"), .25, function (data) {
WS.log('x: ' + data['values'][0] + ' y: ' + data['values'][1] + ' z: ' + data['values'][2]);
WS.pebbleSetBody('x: ' + data['values'][0] + ' y: '+ data['values'][1] + ' z: ' + data['values'][2], false);
});
WS.pebbleSetSubtitle('Accel Data', false);
WS.gestureCallback('onPebbleSingleClick', function (name) {
WS.log('onPebbleSingleClick: ' + name);
WS.pebbleSetTitle(name + ' clicked', false);
WS.say(name);
});
WS.gestureCallback('onPebbleLongClick', function (name) {
WS.log('onPebbleLongClick: ' + name);
WS.pebbleVibe(2);
});
WS.gestureCallback('onPebbleAccelTap', function (axis, direction) {
WS.log('onPebbleAccelTap: ' + axis + ' ' + direction);
});
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment