Chapter 16. Sensing Motion and Attitude

,

In This Chapter

Image Accelerometer sensor

Image Smoothing sensor readings

Image Shake detection

Image Compass sensor

Image Gyroscope sensor

Image Motion sensor

Image Sensor calibration


Chapter 12, “Processing Touch Input,” looked at touch input and gestures, which is ordinarily the first choice for user input in most Windows Phone apps. Yet the hardware of Windows Phone devices provides additional sensors that can be used for input, including an accelerometer, compass, and gyroscope, along with a combined virtual sensor called the motion sensor.

This chapter examines each sensor in detail, beginning with the accelerometer. You see how to process accelerometer readings, and how to simulate acceleration within the Windows Phone emulator. You learn how to apply data smoothing to accelerometer readings to decrease jittering of UI elements without sacrificing responsiveness. You also see how to calibrate the accelerometer and how to perform shake detection using the accelerometer.

The chapter then looks at the compass sensor and how to use the compass’s magnetic heading to build a custom compass app that displays the heading using an arrow. How compass calibration is performed is also discussed.

The chapter then moves to the gyroscope sensor, and you see how to build a UI to display the angular rotation of the phone.

Finally, the chapter discusses the motion sensor, which is a virtual sensor that harnesses the other hardware sensors to improve accuracy and provide extended orientation and motion information.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.94.80