-
-
Save bwhite/9732959 to your computer and use it in GitHub Desktop.
[wearscript] Pebble Example
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 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