Skip to content

Instantly share code, notes, and snippets.

@factormystic
Created May 6, 2012 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save factormystic/2607213 to your computer and use it in GitHub Desktop.
Save factormystic/2607213 to your computer and use it in GitHub Desktop.
using System.Diagnostics;
using Microsoft.Devices.Sensors;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Reactive;
namespace Rx_Compass_Smoothing
{
public partial class MainPage : PhoneApplicationPage
{
Compass compass = new Compass();
public MainPage()
{
InitializeComponent();
Observable.FromEvent<SensorReadingEventArgs<CompassReading>>(compass, "CurrentValueChanged")
.Subscribe(e => Debug.WriteLine(string.Format("Raw: {0}", e.EventArgs.SensorReading.TrueHeading)));
compass.Start();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment