Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

16. Core Motion > 16.0. Introduction

16.0. Introduction

iOS devices such as the iPhone and iPad are usually equipped with accelerometer hardware. Some iOS devices might also include a gyroscope, such as the iPhone 4 and iPad 2. Before attempting to use either the accelerometer or the gyroscope in your iOS applications, you must check the availability of these sensors on the iOS device on which your app runs. Recipes 16.1 and 16.2 include techniques you can use to detect the availability of the accelerometer and gyroscope. With a gyroscope, iOS devices such as the iPhone 4 and iPad 2 are able to detect motion in six axes.

Let’s go through a situation that will show you the value of the gyroscope. The accelerometer cannot detect the rotation of the device around its vertical axis if you are holding the device perfectly still in your hands, sitting in a computer chair, and rotating your chair in a clockwise or counterclockwise fashion. From the standpoint of the floor or the Earth, the device is rotating around the vertical axis, but it’s not rotating around its own y-axis, which is the vertical center of the device. So, the accelerometer does not detect any motion.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint