B4J Question RPi3 - jPi4J Error with PIN 7

Hi all!
First of all, I love your job Erel...
I receive this error trying to use Pin 7 as an input.
(Programming via Netbeans and C++ works well, with B4J no).

Raspberry Pi 3
jPi4J 2.00

B4X:
Private pinCol4 As Int = 7
Private Col4 As GpioPinDigitalInput
Col4.Initialize("Col4",pinCol4)
B4X:
main._initpins (java line: 189)
java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: File o directory non esistente
    at com.pi4j.wiringpi.GpioUtil.export(Native Method)
    at com.pi4j.io.gpio.WiringPiGpioProviderBase.export(WiringPiGpioProviderBase.java:108)
    at com.pi4j.io.gpio.impl.GpioPinImpl.export(GpioPinImpl.java:158)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:565)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:538)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:533)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:645)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:655)
    at anywheresoftware.b4j.objects.GpioControllerWrapper$GpioPinDigitalInputWrapper.Initialize(GpioControllerWrapper.java:157)
    at b4j.example.main._initpins(main.java:189)
    at b4j.example.main._appstart(main.java:102)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
    at b4j.example.main.start(main.java:38)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
    at com.sun.glass.ui.gtk.GtkApplication.lambda$null$5(GtkApplication.java:139)
    at java.lang.Thread.run(Thread.java:748)
 

Erel

Administrator
Staff member
Licensed User
1. You should create a non-ui project.
2. Make sure to run b4j-bridge with sudo.
 
Top