Upload
hilary-murphy
View
222
Download
3
Tags:
Embed Size (px)
Citation preview
Win8 on Intel Programming CourseModern UI : Sensors
Cédric Andreolliwww.Intel-Software-Academic-Program.com
[email protected] Software
2013-03-20
Sensors
Sensors
Sensors in few wordsSensors convert a physical measure into a signalSensors are used for
TemperatureDevice Location : GPSOrientationEtc
Sensors are used in mobile development since many yearsThey are already available on tablet and on some Ultrabooks
Sensors
Why use sensorsUsing sensors can improve the user experienceThey are used in gamesThey are used in augmented realityThey are used in GPS applicationA lot of mobile applications use sensors today !
Different kinds of sensors
Sensors
Device locationGPS is the most popular kind of sensorThe GPS acquire the user position from satellitesWi-Fi can also be used (WPS)Give access to :
LatitudeLongitudeAltitude
Sensors
AccelerometerCompute the properacceleration of an objectAn accelerometer contains3 sensors :
One for the x-axisOne for the y-axisOne for the z-axis
An accelerometer that lay on a table will measureg=-9.81 m/s on the z-axis
Sensors
GyrometerIt measures rotational velocityIt doesn’t define a position but the current rotation speedData difficult to use directly
Sensors
MagnetometerMeasures the strenght of a magnetic fieldCan be used to compute the device orientation
Sensors
Light sensorMeasures the intensity of light in LuxWindows 8 uses the light sensorto set the screen luminosity
Sensor fusion
Sensor fusion
What is the sensor fusionA single sensor do not provide clean dataIt is very hard to get a stable device orientationThe value of a single sensor can suffer from interferenceFusionning sensors can help solving this problem
Sensor fusion
How does it work ?The fusion of the 3 default sensors gives access to :Compass + Inclinometer + Orientation
Programming with sensors
Programming with sensors
Access and RightsSome sensors give access to personal informationExample : GPS gives the user’s current position
You need to activate new capabilitiesOpen the manifest and go to “Capabilities”
Programming with sensors
Programming with sensors
Windows.Devices.SensorsNamespace that gives access to the sensors. References :
AccelerometerCompassGyrometerInclinometerLightSensoretc …
Use the GetDefault() method to access the device :Var accelerometer = Windows.Devices.Sensors.Accelerometer.GetDefault()
Programming with sensors
The AccelerometerEasy to implementNot so easy to use
Represent the proper acceleration on each axis
Interferences can modify the valueLets see how to retrieve the values of this sensor
Programming with sensors
The Accelerometer – full code
Programming with sensors
The Light Sensor – full code
Programming with sensors
The Location serviceImplementation of the location service is differentUsing the location can be very interesting
Show some places of interest near your position
Indicates your current location to a friendetc …
A lot of augmented reality applications use GPS
Programming with sensors
Programming with sensors
The Location Service – full code
Programming with sensors
The Location Service – here’s how it looks
License Creative Commons – By 3.0
You are free:• to Share — to copy, distribute and transmit the work • to Remix — to adapt the work • to make commercial use of the work Under the following conditions:• Attribution — You must attribute the work in the manner specified by the author or licensor (but
not in any way that suggests that they endorse you or your use of the work).With the understanding that: • Waiver — Any of the above conditions can be waived if you get permission from the copyright
holder. • Public Domain — Where the work or any of its elements is in the public domain under applicable
law, that status is in no way affected by the license. • Other Rights — In no way are any of the following rights affected by the license:
– Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; – The author's moral rights; – Rights other persons may have either in the work itself or in how the work is used, such as publicity or
privacy rights. • Notice — For any reuse or distribution, you must make clear to others the license terms of this
work. The best way to do this is with a link to this web page.
http://creativecommons.org/licenses/by/3.0/