Setup Your Environment
First, you'll need to setup your Galileo with Windows. You can find complete instructions for doing that over on our GitHub page. Come back to this page when you have gone through those instructions.
Create a new Project
Open Visual Studio. Select File -> New Project and Select Templates -> Visual C++ -> Windows for IoT -> Galileo Wiring app
Code
#include "stdafx.h"
#include "arduino.h"
int _tmain(int argc, _TCHAR* argv[])
{
return RunArduinoSketch();
}
int led = 13; // This is the pin the LED is attached to.
void setup()
{
pinMode(led, OUTPUT); // Configure the pin for OUTPUT so you can turn on the LED.
}
// the loop routine runs over and over again forever:
void loop()
{
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
Log(L"LED OFF\n");
delay(1000); // wait for a second
digitalWrite(led, HIGH); // turn the LED on by making the voltage HIGH
Log(L"LED ON\n");
delay(1000); // wait for a second
}
This code is included in the default template, and is included here for reference.
Wire your Galileo with an LED
LEDs are diodes which will emit light when powered. They are polarized - meaning they work only when plugged in correctly.
Build and deploy
Press F5 to build and deploy your project.
You may be prompted for credentials. Enter:
Username: mygalileo\Administrator
Password: admin
Failed to deploy?
Under certain network conditions, deploy by name might fail. In this case, it would be best to deploy by IP.
Copy the IP address from Galileo Watcher, by right clicking on the Galileo instance and select Copy IP Address:
Open the project properties by right clicking on the project in Solution Explorer.
Paste the copied IP address into the 'Remote Server Name' field on the debugging tab in Visual Studio:
Result
You should see the light blinking. If it isn't blinking, try reversing the LED leads.
Convert to Lightning
If you have a project which was created before December 1st, 2014, you will need to convert it to Lightning.
1. From within your existing solution, right click on the project and select Manage Nuget Packages
2. Select Installed Packages
in the left column
3. Select Uninstall
to remove Galileo C++ SDK
4. Expand Online then select Nuget.org
5. In the Search
box in the upper right hand corner of the dialog, search for Microsoft IoT C++
6. Select Install
7. Rebuild your project
Update your project
The Microsoft IoT team and the community are adding features and fixing bugs in the SDK. In order to take advantage of these changes, you'll need to manually update your project.
1. From within your existing solution, right click on the project and select Manage Nuget Packages
2. Select Updates
from the left column
3. If you'd like to use a prerelease version, select Include Prereleases
from the dropdown
4. Click the Update
button to update your project.
Comments
Please log in or sign up to comment.