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, ...