Is this frame straight?


Joel Ivory Johnson created a rather functional program for his Zune HD.  Joel created a bubble level based on the accelerometer in the Zune HD to get the tilt of the device.  From that data and everyone's favorite theorem, he created a bubble level!

Joel also explains the math needed for doing this such as calculating the direction and the magnitude.

Vector3 accelReading = accelState.Acceleration;

tiltDirection = (float)Math.Atan2(accelReading.Y, accelReading.X);
tiltMagnitude = (float)Math.Sqrt(accelReading.X * accelReading.X + 
                 accelReading.Y * accelReading.Y );


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.