When I had Raspberry Pi I used to control the GPIO (pins) from a Java application using the Pi4J library.
Is there any library to control the GPIO (pins) on the PcDuino using the Java language?
Answer
I haven't used that platform myself but the Java GPIO Manager appears to be what you're after. Looking at the source code it appears straightforward and is using file access to control the files created by the device driver for each pin under the following path:
/sys/devices/virtual/misc/gpio/mode/
/sys/devices/virtual/misc/gpio/pin/
There is a Accessing GPIO Pins tutorial at Sparkfun that shows for mode
the following values may be used, although they are already declared in the above Java library as constants:
- 0 = Input
- 1 = Output
- 8 = Input with internal pull-up
With the the pin
values just being the obvious 0
for low and 1
for high. Note that those values are in ASCII so use "0"
etc rather than a binary value.
No comments:
Post a Comment