C# program to set I/O Pin
Posted: Tue Oct 30, 2018 8:54 am
I'm not .net programmer but I have to write code in c# programming. I want to understand basic things
How to set input and output pins in c# programming
How to set input and output pins in c# programming
Code: Select all
using Windows.Devices.Gpio;
public void GPIO()
{
// Get the default GPIO controller on the system
GpioController gpio = GpioController.GetDefault();
if (gpio == null)
return; // GPIO not available on this system
// Open GPIO 5
using (GpioPin pin = gpio.OpenPin(5))
{
// Latch HIGH value first. This ensures a default value when the pin is set as output
pin.Write(GpioPinValue.High);
// Set the IO direction as output
pin.SetDriveMode(GpioPinDriveMode.Output);
} // Close pin - will revert to its power-on state
}