I just got Java running on my Raspberry Pi which took a lot more screwing around than i had hoped. I want to be able to read/write data to/from the header pins from Java. How can I do this? Do I need to write a driver or some sort with C first in order to get the data from the header pins? I am running an instance of Soft-float Debian "wheezy." Is this even possible to do in Java? Are there any workarounds that I should know about? Thanks for reading!
2 Answers 2
That should be possible in Java, as referenced here. The library which is used is called rpi-gpio-java and is available at this URL. As stated in the notes, to make it work, please make sure your application is run as root.
Note: Above project rpi-gpio-java is no longer available on google code. Alternate option is PI4J
-
This is interesting. Nice find Dexter.Jivings– Jivings2012年09月02日 11:52:16 +00:00Commented Sep 2, 2012 at 11:52
If you did not already foud your solution, the Pi4J Library, based on Wiring for the Raspberry Pi, offers - also on an early development stage - acces to GPIO, I2C and SPI. And Rs232, not to forget!
Serviceprovider for several IO-boards (Olimex etc.) are included.
Most interesting: Event driven processing (GPIO-Interrupts).
see: here