Interfacing

Using pi4j to control GPIO

38 16242
agropi  
Hello, It's possible to use the java library pi4j ( http://pi4j.com/ ) 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.

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

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

Thanks
Ghoddan

I'd like to use Pi4J with the bananaPi.

Thanks

Rafa

Hello, i have tryed the example that is included in PI4J examples:
http://unpocodejava.wordpress.co ... 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

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

Hello!

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
and
  1. gpio write 19 0
Copy the Code
working fine.

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

The jar pi4j-core.jar has the native library libpi4j.so .
The library libpi4j.so 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 https://github.com/Pi4J/pi4j.git
Sources for version 1.0-SNAPSHOT, I could not find.

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

pi4j.zip

161.66 KB, Downloads: 231

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