Raspberry-GPIO-Manager icon indicating copy to clipboard operation
Raspberry-GPIO-Manager copied to clipboard

Example of how to use a pin for an input

Open KingKuka opened this issue 6 years ago • 2 comments

Could you please give an example of how to use the State property for an input? I understand how to use it for an output but I cant seem to get the input to work.

KingKuka avatar Nov 28 '18 19:11 KingKuka

Also If i build this in windows, it wont let me compile because of a path error. The path is right on the Pi not wont work for windows. Is there a way around this?

KingKuka avatar Nov 29 '18 14:11 KingKuka

To use a pin as an input just set its mode to IN then read the state property: var pin = new GPIOPinDriver(GPIOPinDriver.Pin.GPIO23, GPIOPinDriver.GPIODirection.In); var state = pin.State;

On windows the build will fail because paths are different, they are represented with backslashes instead of forward ones, ie. C:\system32\etc instead of /sys/class/etc, so the library must be built under a Unix-like OS.

AlexSartori avatar Dec 04 '18 11:12 AlexSartori