-
-
Save colegleason/9735180 to your computer and use it in GitHub Desktop.
[wearscript] Pebble
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"> | |
<head> | |
</head> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
<canvas id="canvas" width="640" height="360" style="display:block"></canvas> | |
<script> | |
function cb(data) { | |
WSRAW.log('x: ' + data['values'][0] + ' y: ' + data['values'][1] + ' z: ' + data['values'][2]); | |
WSRAW.pebbleSetBody('x: ' + data['values'][0] + ' y: '+ data['values'][1] + ' z: ' + data['values'][2], false); | |
} | |
function server() { | |
WS.log('Welcome to WearScript-Pebble'); | |
WS.say('Welcome to WearScript-Pebble'); | |
WS.pebbleSetBody('connected!', false); | |
WS.sensorOn(WS.sensor("pebbleAccelerometer"), .25, 'cb'); | |
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); | |
}); | |
} | |
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": "Pebble" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment