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.
2). 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:
- Download the latest zip file of all GrovePi example code here. This will download a zip file you need to extract locally on your hard drive.
- If you’re using Github, you can download the Git here: https://github.com/DexterInd/GrovePi.git
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”
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.
4). Click the Repository in the list. You should see a list of solutions available. Click the “HelloWorldBlinky.sln”
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.
5). Open the HelloWorldBlinky Solution
Open the solution HelloWorldBlinky.sln This file should be under GrovePi/Software/CSharp/Samples/HelloWorldBlinky
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.
7). Open the HelloWorldBlinky Solution
Open the solution HelloWorldBlinky.sln This file should be under GrovePi/Software/CSharp/Samples/HelloWorldBlinky
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.
9). Set up the Project
Right-click on the HelloWorldBlinky project in the Solution Explorer and click Select Set as Startup Project.
Next, right-click on the Properties tab under HelloWorldBlinky and select Open.
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”
Press Ctrl + S (this file will not be saved automatically, you must save it manually).
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).
11). Blinking LED
Voila! You should have a blinking LED on the GrovePi!