API 示例
// 获取陀螺仪传感器监听对象
Gyrometer gyrometer = Gyrometer.GetDefault();
if (gyrometer == null)
{
await new Windows.UI.Popups.MessageDialog("不支持陀螺仪传感器").ShowAsync();
return;
}
// 设置监听事件间隔
gyrometer.ReportInterval = gyrometer.MinimumReportInterval * ;
// 设置监听事件
gyrometer.ReadingChanged += (s, a) =>
{
System.Diagnostics.Debug.WriteLine(string.Format(
"X轴旋转:{0}\r\nY轴旋转:{1}\r\nZ轴旋转:{2}",
a.Reading.AngularVelocityX,
a.Reading.AngularVelocityY,
a.Reading.AngularVelocityZ
));
};