Created
February 19, 2015 01:12
-
-
Save keathley/80e16b28c53991124eb3 to your computer and use it in GitHub Desktop.
a simple test to capture acceleration data from a mobile decive
This file contains hidden or 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> | |
<head> | |
</head> | |
<body> | |
<ul id="log"> | |
</ul> | |
<script> | |
var logger = document.getElementById('log'); | |
window.ondevicemotion = function(event) { | |
var ax = event.accelerationIncludingGravity.x; | |
var ay = event.accelerationIncludingGravity.y; | |
console.log(ax); | |
console.log(ay); | |
var log = document.createElement('li') | |
log.appendChild(document.createTextNode('ax: ' + ax + ', ay: ' + ay )); | |
logger.appendChild(log); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment