Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of how to use a pin for an input #7

Open
KingKuka opened this issue Nov 28, 2018 · 2 comments
Open

Example of how to use a pin for an input #7

KingKuka opened this issue Nov 28, 2018 · 2 comments

Comments

@KingKuka
Copy link

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
Copy link
Author

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?

@AlexSartori
Copy link
Owner

AlexSartori commented Dec 4, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants