B4J Question UP-BOARD

micro

Well-Known Member
Licensed User
Longtime User
You can probably use jShell to control the pins.
I hope it's simple
The board comes in few days, but I know it will not be easy for me.
This is a link where show a example in javascript but as invokes the mraa library with B4J?
https://up-community.org/wiki/MRAA/UPM
https://iotdk.intel.com/docs/master/mraa/up.html

javascript example
B4X:
var m = require('mraa'); //require mraa
console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console

var myLed = new m.Gpio(7); //LED hooked up to digital pin 7
myLed.dir(m.DIR_OUT); //set the gpio direction to output
var ledState = true; //Boolean to hold the state of Led

function periodicActivity()
{
  myLed.write(ledState?1:0); //if ledState is true then write a '1' (high) otherwise write a '0' (low)
  ledState = !ledState; //invert the ledState
  setTimeout(periodicActivity,500); //call the indicated function after 1 second (1000 milliseconds)
}

periodicActivity(); //call the periodicActivity function
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Ok, the board has arrived.
I started with some tests using the jmraa library but in mraa.Initialize
I have these errors:
B4X:
Waiting for debugger to connect...
Program started.
java.lang.UnsatisfiedLinkError: C:\Users\User\Downloads\tempjars\libmraajava.so: Can't load this .dll (machine code=0x101) on a AMD 64-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at anywheresoftware.b4j.objects.MraaController.Initialize(MraaController.java:44)
    at b4j.example.main._appstart(main.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:612)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    at sun.reflect.NativeMethodAccesso
rImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:79)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:92)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:70)
    at b4j.example.main.start(main.java:38)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.w
in.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Unknown Source)
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: C:\Users\User\Downloads\tempjars\libmraajava.so: Can't load this .dll (machine code=0x101) on a AMD 64-bit platform
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:92)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:70)
    at b4j.example.main.start(main.java:38)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinAp
plication.java:191)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\User\Downloads\tempjars\libmraajava.so: Can't load this .dll (machine code=0x101) on a AMD 64-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at anywheresoftware.b4j.objects.MraaController.Initialize(MraaController.java:44)
    at b4j.example.main._appstart(main.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:612)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
    at anywheresoftware.b4a.s
hell.Shell.raiseEvent(Shell.java:159)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:79)
    ... 12 more
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Attached a file for test I/O downloaded from up-board site
 

Attachments

  • up_win_dio_v20160604.zip
    280.7 KB · Views: 271
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Is possibile use a Windows DLL or python script?
On Up-board site ther's a library RPI.GPIO for this board but for Linux.
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
jMRAA will not work with your board.
On this link https://iotdk.intel.com/docs/master/mraa/index.html
reports the various boards supported by mraa:
If you have wrapped mraa lib for the board intel edison why it does not work with up-board?
I think the problem can only be the matching of the pins but at least it must work
I'm wrong?
Thanks for all.
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
This link attached is DIO project in C# and use aaeonEAPI.dll and EAPI.cs class.
In Form1.cs you see the calls to the aaeonEAPI.dll and the variuos dll entrypoint.
It seems simple if the program was in C# but with B4j i can not make it.

Some help if you have time to devote?
Thanks
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
I recommend you to go with the python approach. It shouldn't be too difficult
I need install python on windows but RPI.GPIO or WIRING PY how i install it on windows?
Around I see only installations under linux.

Thanks so much for the support.
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
I'm back Erel,
forgive me but I want to see to use the UP-BOARD to the best.
I found this new file with the mraa.jar and various upm*.jar, can you see how to use them with b4j?
Thanks

file
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Hi Erel
I tried to decompile the mraa.jar file of the previous link and your and are identical, but in your mraa.jar there is libmraajava.so file, what is it for?
Is this that show the error when initialize your jmraa library, but i can not see what's inside in this file (libmraajava.so).
Thanks

P.S.
I looked better, they are not exactly the same
 
Last edited:
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
The libmraajava.so is refers to linux folders paths.
So I think the problem is not the up-board but the operating system, on my board run windows 10.
It's correct?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…