-
Book Overview & Buying
-
Table Of Contents
Windows Application Development Cookbook
By :
The accelerometer is not the only sensor that can be used by UWP applications. The second one that is presented in this chapter is a compass. It allows you to get a heading relative to the magnetic north or geographic true north, if available. Of course, such a heading is returned in degrees. You will learn how to obtain values from a compass sensor in this recipe.
As an example, you will create an application that presents a compass rose that rotates according to the current heading relative to the magnetic north.
To step through this recipe, you only need the automatically generated project.
To prepare an example of rotating a compass rose according to data obtained from the compass sensor, perform the following steps:
CompassBackground.png and CompassIndicator.png files to the Assets directory. These .png files are available together with the code attached to this chapter.Image controls, representing compass...