Introduction
A good programmer must know how to use sensors and manipulate its data.An accelerometer helps your device understand its surroundings better. Is it falling, flying or at rest.
A good programmer can write code to answer all of these question
what is the Accelerometer
The Accelerometer is an electronic device that can measure the g-force affecting a body,the accelerometer is basically a mass attached to a spring , by measuring the force on that spring we can calculate the g-force affecting the body, consider the below figures for a device vibrating up words and down words,
How Smart Phones detect Orientation Changes
If we have three springs in the three axis we can detect orientation changes easily, for example, if the device is lying perpendicular to the ground, only the x-axis spring would be stretched,
But flipping the device will cause the x-axis spring to be relaxed and the z axis-spring to be stretched.
However, this is a basic idea of how the accelerometer works and in the real world it is implemented using electronic components
References:
http://www.dimensionengineering.com/info/accelerometershttp://en.wikipedia.org/wiki/G-force
http://www.youtube.com/watch?v=KZVgKu6v808