2. Run Hello World on Windows IoT (WinIoT) and GrovePi

2. Run Hello World on Windows IoT (WinIoT) and GrovePi

Windows IOT and the GrovePi

Windows IOT and the GrovePi

Step 2: Running Hello World on WinIoT and the GrovePi

This is Step 2 in a 3 part series on Getting Started with WinIoT and the GrovePi+.  See the other parts here.

In this second step, we will walk through all the steps to get your first GrovePi Internet of Things device running on the GrovePi and the Raspberry Pi.

1).  Set up the Hardware

Attach the GrovePi to the Raspberry Pi 2.

GrovePi-wire-with-led-for-winiot-by-dexter-industries2).  Connect the LED

In this example, we will blink a Grove LED on Port D2.  Connect the LED to Port D2.

3).  Download the Example Code

You can download the example code in two ways:

Use Visual Studio Team Explorer

You can also use Visual Studio Team Explorer to get the Github Repository.

1).  Open Team Explorer.  This is the tab next to “Solution Explorer”

Team_Explorer

2).  Click on “Local Git Repositories” in the Team Explorer.

3).  Enter in the address for the Github repository.  https://github.com/DexterInd/GrovePi/ and select the directory you want to clone the repository to.

Clone_GrovePi_Github

4).  Click the Repository in the list.  You should see a list of solutions available.  Click the “HelloWorldBlinky.sln”

Available_Git_repositories

You can view all the example code for C# and the GrovePi here on Github.  The folders “Driver” and “GrovePi” contain the driver code for the GrovePi.  The folder “Samples” contain the various GrovePi C# samples that demonstrate the various sensors with the GrovePi.

4).  Connect to Your Raspberry Pi and GrovePi

Open the WinIoT Core Dashboard and find your device.

Windows_IoT_Dashboard-find-your-device-rename-to-GrovePi

 

5).  Open the HelloWorldBlinky Solution

Open the solution HelloWorldBlinky.sln  This file should be under GrovePi/Software/CSharp/Samples/HelloWorldBlinky

HelloWorldBlinky-File-Location-WinIoT

6). Install Windows 10 SDK

The first time you open the GrovePi solution, you will be prompted to install Windows 10 SDK.  You will need to close Visual Studio.

Run the installation.  This can take up to 30 minutes.  Fortunately this is a one time installation.

Install-windows-10-sdk

7).  Open the HelloWorldBlinky Solution

Open the solution HelloWorldBlinky.sln  This file should be under GrovePi/Software/CSharp/Samples/HelloWorldBlinky

HelloWorldBlinky-File-Location-WinIoT

Again. You only need to install this SDK once!

8).  Add a Reference to the GrovePi Libraries

To install GrovePi for Windows IoT, run the Package Manager Console.  Open it in Visual Studio by going to “Tools” –> “NuGet Package Manager” –> “Package Manager Console”

In the command line, type “Install-Package GrovePi”.  This step requires internet access and will install dependency packages.

Package-Manager-NuGet-GrovePi

 

9).  Set up the Project

Right-click on the HelloWorldBlinky project in the Solution Explorer and click Select Set as Startup Project.

Right_Click_Visual_Studio_Settings

Next, right-click on the Properties tab under HelloWorldBlinky and select Open.

Right_Click_Properties

Select the Debug tab.  Select Remote Machine in the Target device field.

In the Remote Machine field, click the “Find…” button.

Select your Raspberry Pi.  Remember in the previous step we renamed our Raspberry Pi to “GrovePi”.  In the picture below you can see it has a local address of 192.168.3.102.  Click “Select”

Find-GrovePi-Remote-Machine

Press Ctrl + S (this file will not be saved automatically, you must save it manually).

Launch-the-GrovePi-WinIoT-Example-Project

 

10). Run the Sample Solution

Finally, open the file “StartupTask.cs” from the Solution Explorer.

Press F5 to launch the debugger (it will take a minute or two to deploy your app onto the Raspberry Pi).

Debug-Action-Begins

Running-the-GrovePi-Example

11).  Blinking LED

Voila!  You should have a blinking LED on the GrovePi!

Blinking-Gif-Small

 

 

Next Step: 3. More WinIoT GrovePi Samples and Examples

Did we miss something?  Ask us about it on the forums here!

{"cart_token":"","hash":"","cart_data":""}