B4J Library [IoT] jPi4J - Raspberry Pi GPIO controller

Discussion in 'B4J Libraries & Classes' started by Erel, Feb 5, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    You have created a UI app. This example was written for a non-UI app.
     
  2. YIM bunchhat

    YIM bunchhat Active Member Licensed User

    So whould you mind to show me how to created non-UI app. I am new with this. Thank
     
  3. Toley

    Toley Active Member Licensed User

    File -> New -> Non-UI
     
    Peter Simpson and Erel like this.
  4. YIM bunchhat

    YIM bunchhat Active Member Licensed User

    Thank now it work well.
     
  5. Marek Sukop

    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.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    You cannot use this library from an Android project.
     
  7. Hypnos

    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!
     
  8. Erel

    Erel Administrator Staff Member Licensed User

  9. YIM bunchhat

    YIM bunchhat Active Member Licensed User

    I want to use library Jpi4j to generate signal PWM with GPIO of Raspberry Pi. How can I do? Thank
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    You cna use GpioPinDigitalOutput.Pulse together with a timer.
     
    Arash Davidi and Peter Simpson like this.
  11. lucdrb

    lucdrb Member Licensed User

  12. Erel

    Erel Administrator Staff Member Licensed User

    It should be simple to call these two methods with JavaObject.

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

    daniedb Active Member Licensed User

    Can someone maybe download the jPi4J.zip file. FOr some reason, it stop between 50-60% and said finish. But file corrupt. And Email to me, danie@leznadsoftware.co.za
    Thanks
    Danie
     
  14. lucdrb

    lucdrb Member Licensed User

    Everything goes fine for me
     
  15. daniedb

    daniedb Active Member Licensed User

    Thanks. Some guys did email me the file. For some reason stop downloading by me.

    Cheers
     
  16. GPN

    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.
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    Can you post your code?
     
  18. GPN

    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
     
  19. GPN

    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?
     
  20. Mark Turney

    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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice