The iPhone’s accelerometer measures the linear acceleration of the device so that it can report its roll and pitch, but not its yaw.
Yaw, pitch, and roll refer to the rotation of the device in three axes. If you think about an aircraft in the sky, pushing the nose down or pulling it up modifies the pitch angle of the aircraft. However, if you keep the nose straight ahead, you can also modify the roll of the aircraft using the flaps; one wing will come up, the other will go down. Finally, keeping the wings level you can use the tail flap to change the heading (or yaw) of the aircraft (rotating it in a 2D plane).
If you are dealing with an iPhone 3GS, which has a digital compass, you can combine the accelerometer and magnetometer readings to have roll, pitch, and yaw measurements (see the following section for details on how to access the magnetometer).
The accelerometer reports three figures: X, Y, and Z (see Figure 10-5). Acceleration values for each axis are reported directly by the hardware as G-force values. Therefore, a value of 1.0 represents a load of approximately 1-gravity (Earth’s gravity). X corresponds to roll, Y to pitch, and Z to whether the device is front side up or front side down, with a value of 0.0 being reported when the iPhone is edge-on.
Figure 10-5. The iPhone accelerometer axes
When dealing with acceleration measurements, you must keep ...