Using pi4j to control GPIO

37 21111
Hello, It's possible to use the java library pi4j ( ) on banana to control GPIO?
I used it on raspberry pi and it works fine but on banana (running the same example ) nothing work.
I simply want to blink a led (GPIO_01): i've to connenct tried all possible pins but the led is ever turned off.
Someone can help me?
Now Lemaker has ported RPi.GPIO and WiringPi into the Banana Pi. The two can work well. But we didn't test the pi4j, we don't know much about it. But if many users want to use, we will plan to make it work.

Yes, I want it.
Java on Banana Pi is very cool!

Hello tony_zhang,
I would also be very interested in using Pi4J with the BananaPi.


I'd like to use Pi4J with the bananaPi.



Hello, i have tryed the example that is included in PI4J examples: ... pberry-pi-con-java/

and I have notice that the first time, when you turn on the bananapi, and begins to run the program, the light turns on, but it doesn't do any more.

thanks, Rafa

Hello All

I was looking at the code and saw that PI4J internally uses WiringPI if the WiringPI is already ported, I think the PI4J will work.

Luiz Lago

Edited by cgen at 2014-10-16 13:55


When I'm using version 0.0.5, an error occurs: wiringPiSetup: mmap failed: No such file or directory .
If I'm using version 1.0-SNAPSHOT, it is possible only to set a HIGH level on the pin.
  1. GpioController gpio = GpioFactory.getInstance();
  2. GpioPinDigitalOutput pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_19, "MyLED", PinState.LOW);
Copy the Code
  1. gpio readall
Copy the Code
for checking result.

The commands
  1. gpio write 19 1
Copy the Code
  1. gpio write 19 0
Copy the Code
working fine.

Hi, guys! I figured out the problem. It's simple .

The jar pi4j-core.jar has the native library .
The library statically linking with libwiringPi.a .
So you should to build it for your system. Then place it in the file pi4j-core.jar.

This is for version 0.0.5 from
Sources for version 1.0-SNAPSHOT, I could not find.

I attached the JAR and library, but I have Ubuntu, so it may not work for you.

161.66 KB, Downloads: 232

cgen replied at 2014-10-24 17:53
Hi, guys! I figured out the problem. It's simple .

The jar pi4j-core.jar has the native library  ...

Good ! Thanks for sharing!

You have to log in before you can reply Login | Sign Up

Points Rules