HelloBlinky is one of the shortest and easily understandable program which illustrates Raspberry PI GPIO programming.

In the following example we are using Raspberry PI with Windows 10 IoT Core.


What is GPIO?

GPIO stands for general-purpose input/output and it is a generic pin on a Raspberry/Arduino board. Each pin can be configured to be input or output.

If pin is configured as an input

Use it for buttons, measuring temperature, measuring light,  measuring distance

If pin is configured as an output

Use it for LEDs, motors, relays, lamps

Pin identification number

Each pin has its own personal number. This number is used to communicate with the pin. The pin number to use to communicate has an orange background. Do not try to use the numbers with grey backgrounds! It wont work and you will get an error.

Raspberry PI pinout

Raspberry PI has two special pins which are to control the green and red LED integrated on the board. The green LED’s pin number is 35 and the red’s pin number is 47.

Windows 10

In order to set up Windows 10 IoT Core to your Raspberry, please follow the instructions here: https://developer.microsoft.com/en-us/windows/iot/Docs/GetStarted/rpi2/sdcard/stable/getstartedstep1 

Visual Studio

To start new Raspberry project, use the Visual Studio template “Background Application (IoT)”.

Visual Studio Background Application IoT

If you do not have this project template, then open menu Visual Studio –> Tools –> Extensions and Updates. From there, click online, search for the string “iot” and install “Windows IoT Core Project Templates for VS”.

Visual Studio Tools Extensions and Updates


Blinky code and explanation.

Blinky code and explanation

using Windows.ApplicationModel.Background;
using Windows.Devices.Gpio;
using System.Threading.Tasks;
namespace HelloBlinky
    public sealed class StartupTask : IBackgroundTask
        public void Run(IBackgroundTaskInstance taskInstance)
            int LED_PIN = 35;
            var gpio = GpioController.GetDefault();
            GpioPin pin = gpio.OpenPin(LED_PIN);