Skip to content

Instantly share code, notes, and snippets.

@mayur-tendulkar
Created March 7, 2015 14:56
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 mayur-tendulkar/d53b8b2626b0e0e760be to your computer and use it in GitHub Desktop.
Save mayur-tendulkar/d53b8b2626b0e0e760be to your computer and use it in GitHub Desktop.
Attach ReadingChanged Event to sensor object and set initial properties
//For Gyrometer
if (_gyrometer != null)
{
// Establish the report interval for all scenarios
uint minReportInterval = _gyrometer.MinimumReportInterval;
uint reportInterval = minReportInterval > 16 ? minReportInterval : 16;
_gyrometer.ReportInterval = reportInterval;
// Assign an event handler for the gyrometer reading-changed event
_gyrometer.ReadingChanged += ReadingChanged;
}
//For SimpleOrientationSensor
if (_simpleorientation != null)
{
_simpleorientation.OrientationChanged += OrientationChanged;
}
//For LightSensor
if (_lightsensor != null)
{
uint minReportInterval = _lightsensor.MinimumReportInterval;
uint reportInterval = minReportInterval > 16 ? minReportInterval : 16;
_lightsensor.ReportInterval = reportInterval;
_lightsensor.ReadingChanged += ReadingChanged;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment