The new Windows.Devices namespace from the Universal Windows Platform (UWP) APIs in Windows 10, enable developers to leverage the power of Windows while interacting with the real world via sensors and actuators.
This project uses the I2C bus and general purpose input/output (GPIO) ports available on the Raspberry Pi 2, to create an internet connected weather station using the SparkFun weather shield.
The instructions provided will give a developer first-hand experience setting up the required hardware along with writing and debugging the newly available Windows 10, UWP Windows.Devices API's. This lab will also demonstrate how to aggregate your data in cloud using the Azure Event Hub, via the easy-to-use ConnectTheDots API.
You need to find the following line in the `Mainpage.xaml.cs` file from the `build2015-weather-station` project, and replace the computer name, "minwinpc", in the URL with the name of your IoT device.
//TODO: On the following line, replace "minwinpc" with the computer name of your IoT device (i.e. "http://:50001").
private Uri weatherUri = new Uri("http://minwinpc:50001");
Enable the "Task List" display
Double-click on any item in the list and jump straight into the source!
Each //TODO: is preceded by comments and HINTS to help you with the missing sections.
Open "WeatherStationWeatherStation.sln" in Visual Studio 2015
Navigate to "WeatherShield.cs" in the "Solution Explorer" pane
If you chose the lab branch, Navigate to “View >> Other Windows >> Task List”, to view the remaining work (depicted above).
You will notice there is quite a bit of detail in the comment to help you complete the task. However, if you still need that extra nudge, there will be a “HINT” provided to remind you to look to nearby code for help (illustrated above).
Once the //TODO:'s have been completed, click the “Debug” menu item, and select “WeatherStation Properties…”
Under the “Debug” tab, in the “Start options” section
Deploy to the Windows IoT Core device
OR
Open "WeatherStationWeatherStation.sln" in Visual Studio 2015
Navigate to "WeatherStationTask.cs" in the "Solution Explorer" pane
Use the "Task List" to jump to each “//TODO:” and write the necessary code
The AppSettings, ConnectTheDotsSensor, and ConnectTheDotsHelper files are all part of the code created to help you use the ConnectTheDots interface to the Azure Event Hub.
AppSettings: Saves the settings for connecting to the Event Hub
This information can be found under your ServiceBus in Azure.
Go to your "*-ns" servicebus instance -> Event Hubs -> ehdevices -> Connection Information -> Look for the SAS "D1"
Copy the connection string which should look like this (It contains information for your AppSettings)
"Endpoint=sb://iotbuildlab-ns.servicebus.windows.net/;SharedAccessKeyName=D1;SharedAccessKey=iQFNbyWTYRBwypMtPmpfJVz+NBgR32YHrQC0ZSvId20="
ConnectTheDotsSensor: Contains the information for a sensor
ConnectTheDotsHelper: Helper functions to initialize the Event Hub
If you would like to setup your own Event Hub back-end, follow the instructions in the ConnectTheDots GitHub repository: https://github.com/msopentech/connectthedots/blob/master/Azure/AzurePrep/AzurePrep.md
Once you have it deployed, it should start sending data to the event hub and the data should be viewable on http://iotbuildlab.azurewebsites.net/ or your own website.
[vc_row css=".vc_custom_1470325448228{background-color: #1e73be !important;}"][vc_column][vc_column_text]
[/vc_column_text][/vc_column][/vc_row]
Source: http://microsoft-news.com/microsoft-announces-new-visual-studio-dev-essentials-program/
Chat with an expert about your business’s technology needs.