- Accelerometer
- Compass
- Geolocation
- Gyrometer
- Inclinometer
- Light Sensor
- Orientation Sensor
Inclinometer
The inclinometer provides the pitch, roll, and yaw values of the device. This allows you to understand the orientation of the device relative to the ground (or more specifically, the direction that gravity is acting on the device). You use this sensor to determine if the device is twisted or tilted. For an explanation of pitch, roll, and yaw refer to this article on the NASA website at http://www.grc.nasa.gov/WWW/K-12/airplane/rotations.html.
Listing 4.8 demonstrates code that reads the pitch, roll, and yaw values for the device.
Listing 4.8: Reading the Inclinometer
async private void ReadingChanged(object sender, InclinometerReadingChangedEventArgs e) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { InclinometerReading reading = e.Reading; ScenarioOutput_X.Text = String.Format("{0,5:0.00}", reading.PitchDegrees); ScenarioOutput_Y.Text = String.Format("{0,5:0.00}", reading.RollDegrees); ScenarioOutput_Z.Text = String.Format("{0,5:0.00}", reading.YawDegrees); }); }
Learn more about the inclinometer online at http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.sensors.inclinometer.aspx.