Chapter 15. Whee! Accelerometer!
One of the coolest features of the iPhone and iPod Touch is the built-in accelerometer, the tiny device that lets the iPhone know how it's being held and if it's being moved. The iPhone OS uses the accelerometer to handle autorotation, and many games use it as a control mechanism. It can also be used to detect shakes and other sudden movement.
Accelerometer Physics
An accelerometer measures both acceleration and gravity by sensing the amount of inertial force in a given direction. The accelerometer inside iPhone is a three-axis accelerometer, meaning that it is capable of detecting either movement or the pull of gravity in three-dimensional space. As a result, you can use the accelerometer to tell not only how the ...
Get Beginning iPhone 3 Development: Exploring the iPhone SDK now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.