B4J Library [IoT] jPi4J - Raspberry Pi GPIO controller

Erel

Administrator
Staff member
Licensed User
You have created a UI app. This example was written for a non-UI app.
 

Marek Sukop

New Member
Licensed User
Hi, I am new here. I have installed on my computer B4A (enterprise version). Simple apps for mabile phone are well, but I have problem with my banana Pi. I have installed there android 4.2.2. I have transfered all files from jPi4J.zip to library folder (B4A). Application fals if I use controller.Initialize(). I'm the begginer and I don't understant it.

LogCat connected to: 20080411
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
** Activity (main) Create, isFirst = true **
java.lang.UnsatisfiedLinkError: Native method not found: com.pi4j.wiringpi.Gpio.wiringPiSetup:()I
at com.pi4j.wiringpi.Gpio.wiringPiSetup(Native Method)
at com.pi4j.io.gpio.RaspiGpioProvider.<init>(RaspiGpioProvider.java:47)
at com.pi4j.io.gpio.GpioFactory.getDefaultProvider(GpioFactory.java:102)
at com.pi4j.io.gpio.impl.GpioControllerImpl.<init>(GpioControllerImpl.java:67)
at com.pi4j.io.gpio.GpioFactory.getInstance(GpioFactory.java:85)
at anywheresoftware.b4j.objects.GpioControllerWrapper.Initialize(GpioControllerWrapper.java:52)
at b4a.example.main._activity_create(main.java:303)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at b4a.example.main.afterFirstLayout(main.java:98)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:816)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:582)
at dalvik.system.NativeStart.main(Native Method)

Second question: In my menu is no possibility to choose New Non-UI app. Whats wrong???

Thank's for answer.
 

Hypnos

Active Member
Licensed User
I want to try the "Piface control and display" board, can I use this library to change the text on the LCD display and also detect the button status on the board ? Am I correct that I have to use I2C to write my text ? thanks!
 

Erel

Administrator
Staff member
Licensed User
It should be simple to call these two methods with JavaObject.

For example:
B4X:
Dim jo As JavaObject
jo.InitializeStatic("com.pi4j.wiringpi.SoftPwm")
jo.RunMethod("softPwmCreate", Array (pin, value, range))
 

GPN

Member
Licensed User
Hi All,
I'm using jPi4J but it doesn't work with Digital Output.
I can't change state of Pins. I use RPi v2 B+

controller.Initialize
Pin1.Initialize(15,False)

or

controller.Initialize
Pin1.Initialize(15,True)

is the same thing: the Pin1 state go high and I can't change it's state.

Is there any way to change one specific initialised output to an input?
I've to implement one-wire protocol.

Pin numbering is limited to 1-20. Could you expand the pinout?

Could you help me?

Thanks,
regards,
Giuseppe.
 

GPN

Member
Licensed User
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region

Sub Process_Globals
Dim controller As GpioController
Dim Pin1 As GpioPinDigitalOutput
End Sub

Sub AppStart (Args() As String)
controller.Initialize
Pin1.Initialize(15,False))
controller.Shutdown
End Sub
 

GPN

Member
Licensed User
Hi,
I've solved by copying the ne library Pi4J in the library dir.
Now, I've to tu use GpioPinDigitalMultipurpose.
How I can do it?
Could you help me?
 

Mark Turney

Active Member
Licensed User
Just ordered the Canakit Ultimate Pi 2 kit, Piface rev 2 board, case to hold both and iPazzPort keyboard. Should be here next week. Can't wait!! :D
 
Top