Raspberry-GPIO-Manager
Raspberry-GPIO-Manager copied to clipboard
Example of how to use a pin for an input
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.
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?
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.