This sample demonstrates how to communicate with GPIO using the Micorosot.IoT.Providers.Lightning.I2cProvider
It’s based on the BlinkyHeadless sample. And shares the same setup steps as well as most of the code. The only difference is setting the Lightning provider as the default controllers provider.
The original code of the Blinky Headless sample used the default GPIO provider for obtaining the GPIO controller:
To enable the use of the Lightning provider, the GPIO controller initialization code needs to be modified to set the Lightning provider as the default provider. In the initialization code below, if the Lightning driver is enabled on the target device, the Lightning provider will be used. Otherwise, the app falls back to using the default provider.
Enable Lightning on your Raspberry Pi2 or MBM device using the the steps outlined in the Lightning Setup Guide.
Ensure the correct version of the Windows SDK is installed on your development machine. The required Windows SDK can be installed from here.
Clone the source for the Blinky Background (Headless) sample for Lightning from Github to a local folder.
To setup the LED connectons, refer to the original BlinkyHeadless sample.
Load the solution in Visual Studio.
Build the app.
Deploy and run the app on your device.
You can use the Deploying an App with Visual Studio for guidance.