Skip to content

Instantly share code, notes, and snippets.

@videlais
Created December 25, 2013 12:11
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 videlais/83eb45eab027ddb6be3d to your computer and use it in GitHub Desktop.
Save videlais/83eb45eab027ddb6be3d to your computer and use it in GitHub Desktop.
Accelerometer2
function handleOrientation(event) {
absolute = event.absolute;
alpha = event.alpha;
beta = event.beta;
gamma = event.gamma;
}
function handleMotion(event) {
acceleration = accelerationIncludingGravity = rotationRate = {};
acceleration.x = event.acceleration.x;
acceleration.y = event.acceleration.y;
acceleration.z = event.acceleration.z;
accelerationIncludingGravity.x = event.accelerationIncludingGravity.x;
accelerationIncludingGravity.y = event.accelerationIncludingGravity.y;
accelerationIncludingGravity.z = event.accelerationIncludingGravity.z;
rotationRate.alpha = event.rotationRate.alpha;
rotationRate.beta = event.rotationRate.beta;
rotationRate.gamma = event.rotationRate.gamma;
interval = event.interval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment