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
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

16. Core Motion > 16.5. Retrieving Gyroscope Data

16.5. Retrieving Gyroscope Data

Problem

You want to be able to retrieve information about the device’s motion from the gyroscope hardware on an iOS device.

Solution

Follow these steps:

  1. Find out whether the gyroscope hardware is available on the iOS device. Please refer to Recipe 16.2 for directions on how to do this.

  2. If the gyroscope hardware is available, make sure it is not already sending you updates. Please refer to Recipe 16.2 for directions.

  3. Use the setGyroUpdateInterval: instance method of CMMotionManager to set the number of updates you want to receive per second. For instance, for 20 updates per second (one second), set this value to 1.0/20.0.


  

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