Visual Studio Requirements

Windows IoT Extension for UWP extension is needed – right clicking on your project. Then, select Add > Reference.. 

Select Universal Windows > Exensions > Windows IoT Extension for the UWP, select the latest version and press OK

Add IO Pins Capability

(Includes adding SPI port, I2C port, etc capabilities)

To enable the IO pins open “Package.appxmanifest” > Capabilities Tab > Select “Low Level”

Namespace

using Windows.Devices.Gpio;

Using IO Pins

You can setup the IO pins in the App.xaml.cs OnLaunched() function no problem, but don’t set them up in the App() constructor

Defining your pins
	//IO PINS
	private GpioPin GpioPinMotorEnable;
	private GpioPin GpioPinMySwitch;
Initialising
	//------------------------------
	//----- INITIALISE IO PINS -----
	//------------------------------
	var gpio = GpioController.GetDefault();
	if (gpio == null)
	{
		//ERROR
		return;
	}

	GpioPinMotorEnable = gpio.OpenPin(17);					//<<<RPi GPIO## Pin number
	GpioPinMotorEnable.Write(GpioPinValue.Low);
	GpioPinMotorEnable.SetDriveMode(GpioPinDriveMode.Output);

	GpioPinMySwitch = gpio.OpenPin(18);                     //<<<Rpi GPIO## Pin number
	GpioPinMySwitch.SetDriveMode(GpioPinDriveMode.Input);
Setting Output Pins
	GpioPinMotorEnable.Write(GpioPinValue.Low);

	GpioPinMotorEnable.Write(GpioPinValue.High);
Reading Input Pins
	if (GpioPinMySwitch.Read() == GpioPinValue.High)
	{
	}
UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.