Created
February 14, 2013 03:39
-
-
Save nickharris/4950450 to your computer and use it in GitHub Desktop.
insert sensor reading from .NET MF to Mobile Services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void temperatureHumidity_MeasurementComplete(TemperatureHumidity sender, double temperature, double relativeHumidity) | |
{ | |
//may as well take a light reading as well | |
double lightPercentage = lightSensor.ReadLightSensorPercentage(); | |
//create a new sensor reading and set the values | |
var reading = new SensorReading() | |
{ | |
SensorID = "nicks-office", //can you believe i have to share my office with http://ntotten.com ? | |
Temp = temperature, | |
Humidity = relativeHumidity, | |
Light = lightPercentage, | |
DateAdded = DateTime.UtcNow | |
}; | |
//insert into your Windows Azure Mobile Service and your done! | |
var json = MobileService.GetTable("SensorReading").Insert(reading); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment