The classic LED blinking app (we'll guide you through the necessary wiring on your MinnowBoard Max).
We’ll create a simple Blinky app and connect a LED to your MinnowBoard Max (or MBM for short).
You can find this sample in the Samples\Blinky folder. Choose either the C++ version or C# version.
Make sure you set the ‘Remote Debugging’ setting to point to your MBM. Go back to the basic ‘Hello World’ sample if you need guidance.
You’ll need a few components:
a LED (whichever color you like)
a 220 Ω resistor
a breadboard and a couple of connector wires

Connect one end of the LED to GPIO_S5[0] (pin 21 on the JP1 expansion header) on the MBM, the other end to the resistor, and the resistor to the 3.3 Volts power supply from the MBM.
Here is the schematics:

And here is the JP1 connector on the MBM:

When everything is set up, you should be able to press F5 from Visual Studio: The Blinky app will deploy and start on the MBM, and you should see the LED blink in sync with the simulation on the screen.

Congratulations! You controlled one of the GPIO pins of the MBM!
The code for this sample is pretty simple. We use a timer, and each time the ‘Tick’ event is called, we flip the state of the LED.
Here is how you set up the timer in C#:
public MainPage()
{
// ...
this.timer = new DispatcherTimer();
this.timer.Interval = TimeSpan.FromMilliseconds(500);
this.timer.Tick += Timer_Tick;
this.timer.Start();
// ...
}
private void Timer_Tick(object sender, object e)
{
FlipLED();
}To drive the GPIO pin, first we need to initialize it. Here is the C# code (notice how we leverage the new WinRT classes in the Windows.Devices.Gpio namespace):
using Windows.Devices.Gpio;
private async void InitGPIO()
{
try
{
var deviceId = GpioController.GetDeviceSelector("GPIO_S5");
var deviceInfos = await DeviceInformation.FindAllAsync(deviceId, null);
var controller = await GpioController.FromIdAsync(deviceInfos[0].Id);
GpioPinInfo pinInfo;
controller.Pins.TryGetValue(0, out pinInfo);
pinInfo.TryOpenOutput(GpioPinValue.High, GpioSharingMode.Exclusive, out this.outPin);
GpioStatus.Text = "GPIO pin initialized correctly.";
}
catch (Exception)
{
GpioStatus.Text = "There were problems initializing the GPIO pin.";
}
}Let’s break this down a little:
First, we use GpioController.GetDeviceSelector() to gather the deviceId for the GPIO_S5 set of pins.
Then we gather the device information about this pins with DeviceInformation.FindAllAsync().
Once we have the array of info, we can grab the controller for GPIO_S5 using GpioController.FromIdAsync().
Now that we have the controller, we can access the single GpioPinInfo we are interested in (which is pin 0) accessing the GpioController.Pins dictionary.
From the pinInfo, we call GpioPinInfo.TryOpenOutput() to open the pin in ‘output’ mode. We’ll use pinOut, which is of type GpioOutputPin, to modify the state of the GPIO pin.
Once we have access to the GpioOutputPin instance, it’s trivial to change the state of the pin to turn the LED on or off.
To turn the LED on, simply set the value of the pin to GpioPinValue.Low:
this.outPin.Value = GpioPinValue.Low;and of course, set it to GpioPinValue.High to turn the LED off:
this.outPin.Value = GpioPinValue.High;Remember that we connected the other end of the LED to the 3.3 Volts power supply, so we need to drive the pin to low to have current flow into the LED.
As always, for questions and feedback, contact us.