Reputation: 1927
Everytime I open a GPIO pin I get this exception:
WinRT information: Failed to open a handle to the device.
A resource required for this operation is disabled.
I can't seem to find much information for this on the internet. Probably because UAP is still in a preview. And I don't think something is wrong with my code, it is almost the same one from the Blink example:
GpioController gpio = GpioController.GetDefault();
if (gpio != null)
{
var ledpin = gpio.OpenPin(11);
ledpin.Write(_light ? GpioPinValue.High : GpioPinValue.Low);
ledpin.SetDriveMode(GpioPinDriveMode.Output);
}
Upvotes: 9
Views: 2609
Reputation: 7385
Only a subset of pins are available to usermode. Most pins are reserved by the system and cannot be accessed from usermode.
As far as I know pin 11 is not available. Try pin 12 or 13.
List of available Pins:
GPIO# Power-on Pull Header Pin
4 PullUp 7
5 PullUp 29
6 PullUp 31
12 PullDown 32
13 PullDown 33
16 PullDown 36
17 PullDown 11
18 PullDown 12
19 PullDown 35
20 PullDown 38
21 PullDown 40
22 PullDown 15
23 PullDown 16
24 PullDown 18
25 PullDown 22
26 PullDown 37
27 PullDown 13
35 PullUp Red Power LED
47 PullUp Green Activity LED
Edit: Added missing GPIOs
Upvotes: 10