B4A Library IOIO board library

The request in this thread here introduced me to a product called IOIO that seems to have been designed by some Google engineers in the 20% of time that Google gives them to pursue their own interests,

The blog of the main mover of the project is at Microcontrollers, Electronics & Robotics: Meet IOIO - I/O for Android

The board will be available soon from here IOIO for Android - SparkFun Electronics

As the software has just been released I took a look at it and wrapped it in a couple of libraries for use with Basic4android. I obviously cannot test it as I have no board but the Basic4android library is a very thin veneer on top of the normal Android library so, typos and idiot errors aside, it should work with no problems and the software documentation should be pretty much applicable. I have copied a lot of the library help from the software documention so a B4A help viewer should give you a good grounding in how to use it.

I don't yet know if the board will be available this side of the pond - if anyone wants to ship me one for testing .... :)

EDIT :- Version 1.1 posted with INTERNET permission. See post #11 for details.

EDIT :- Version 1.2 posted with PulseInput. See post #37 for details.

EDIT :- Version 1.2 reposted with XML error fixed. See post #39 for details.

EDIT :- Version 1.3 posted with SPI and I2C support. See post #40 for details.

EDIT :- Version 1.3a posted with IOIOlib 3.2 included. See post #42 for details.

EDIT :- Version 1.4 posted. See post #47 for details.

EDIT :- IOIOlibBT 3.10 posted. See post#58 for details.

EDIT:- IOIOBT1.4 posted See post #63 for details

EDIT:- IOIOBT1.5 posted See post #77 for details.

THESE ATTACHMENTS ARE NOW OBSOLETE. SEE POST #105 FOR THE LATEST VERSIONS BY KOLBE: http://www.b4x.com/android/forum/threads/ioio-board-library.8942/page-6#post-90731
 

Attachments

  • IOIOBT1.5.zip
    102.3 KB · Views: 2,196
  • IOIO1.4.zip
    100.5 KB · Views: 1,658
Last edited by a moderator:

kolbe

Active Member
Licensed User
Longtime User
Kolbe,
Thanks for your reply. I am very happy that you have already device mode working. I will be waiting to release your updated version! :)

Forgot to mention also that you need to do ioio.initialize or else the ioio won't connect.
 

kolbe

Active Member
Licensed User
Longtime User
Just posted version 2.02 of the library. This version supports connecting the IOIO as a device. Also added some small improvements and fixes. You can now see the connections supported by your device with the string returned by IOIO.Initialize.
 

gmilias

Member
Licensed User
Longtime User
Kolbe,
Thanks for the updated version and especially for your fast replies! I've already tested it (ioio as a device) with my application and works like a charm! Now we can use ioio with a lot of alternative ways and this enable us to face every project's limitations.

:)
 

mrodriguez

Member
Licensed User
Longtime User
Kolbe/gmilias, I have brought my ioio board to my summer vacation to do some small tests (I brought just one sensor > sharp proximity). I'm trying to use ioio as a device with my galaxy s4 (android 4.2). It is not working. I'm doing something wrong but i don't know what.

Is it ok?
a) Turn off USB debugging
b) A-B usb cable between ioio and galaxy (red usb cable that comes with ioio board + normal black usb cable)
c) ioio Firmware: Hardware version: SPRK0020, Bootloader version: IOIO0400, Application version: IOIO0500
d) B4A appp: workbench 232, ioio library 2.02
e) ioio jumper: Automatic (host just for ioio 12v with bluetooth)

The ioio red power LED don't turn on when connecting ioio to galaxy. (Misha Seltzer's led turn on > )
When pressing connection button on ioio workbench 232 app, error > Exception connection lost

Any idea?
Thanks!
 

gmilias

Member
Licensed User
Longtime User
Kolbe/gmilias, I have brought my ioio board to my summer vacation to do some small tests (I brought just one sensor > sharp proximity). I'm trying to use ioio as a device with my galaxy s4 (android 4.2). It is not working. I'm doing something wrong but i don't know what.

Is it ok?
a) Turn off USB debugging
b) A-B usb cable between ioio and galaxy (red usb cable that comes with ioio board + normal black usb cable)
c) ioio Firmware: Hardware version: SPRK0020, Bootloader version: IOIO0400, Application version: IOIO0500
d) B4A appp: workbench 232, ioio library 2.02
e) ioio jumper: Automatic (host just for ioio 12v with bluetooth)

The ioio red power LED don't turn on when connecting ioio to galaxy. (Misha Seltzer's led turn on > )
When pressing connection button on ioio workbench 232 app, error > Exception connection lost

Any idea?
Thanks!
Mrodriguez,
You have to use an otg cable (not the red one with ioio otg because it cannot be plugged in your s4) to be connected with your galaxy s4 and another cable male A to micro B (like this that you use in order to connect your s4 with the pc) to be connected with the ioio otg. Only then you can power the ioio by the s4.
Good luck.
 

mrodriguez

Member
Licensed User
Longtime User
Kolbe, you should open a paypal donate account to recieve money for your job.
Agraham did it and I have donated him 75 usd for his usb2serial library.
I think this is the best way to say THANK YOU.
 

mrodriguez

Member
Licensed User
Longtime User
Mrodriguez,
You have to use an otg cable (not the red one with ioio otg because it cannot be plugged in your s4) to be connected with your galaxy s4 and another cable male A to micro B (like this that you use in order to connect your s4 with the pc) to be connected with the ioio otg. Only then you can power the ioio by the s4.
Good luck.
gmilias, it works! Thanks
 

mrodriguez

Member
Licensed User
Longtime User
Kolbe, ioio as device works but i can't reconnect it. I have to unplug ioio from my celular in order to close the app when conection error appears.
Any idea? The bug happens in yatai demo app too?
Thanks
 

kolbe

Active Member
Licensed User
Longtime User
Why is there a connection error? The best would be to look at the logs and see why and then avoid the problem. As far as I know there isn't a way to avoid unplugging to reestablish connection once the connection is corrupted.

I see Ytai updated to 5.03 in the last couple days so I'll update once I get a chance.
 

mrodriguez

Member
Licensed User
Longtime User
Kolbe, after some tests the bug is on Rikomagic IV device, it not happens over Galaxy S4.
I tested the HelloIOIO.apk from Ytai website with the same result.
The problem appears when i press disconnect button. It didnt rise an error, just stay on CONNECTED state. I have to unplug the IOIO in order to change it to DEAD state.
Thanks
 

Fossil

Member
Licensed User
Longtime User
B4A Demo for IOIO

I have just received my IOIO and put together a B4A version of the IOIOHello demo. It toggles the yellow stat LED on the IOIO.

The B4A library works fine for this demo.

The only issue I had was that the application requires the android.permission.INTERNET permission. I found this on the IOIO wiki. There is a comment in the project source code with details.

Demo project is attached.

Hi,
I just try to use your program as a first step for creating own ioio-applications.
It did not work.
I couldn't find the "AndroidManifest.xml File" and don't know where the project's root is.
I found under "Project" a "Manifest Editor", where you can only change one file and added under
"Add Manifest text" what you wrote.
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>)
But trying to compile I see:
Parsing code. Error
Error parsing program.
Error description: Unknown type: ioio
Are you missing a library reference?
Occurred on line: 34
Dim YOYO As IOIO

Can you help me?
 

kolbe

Active Member
Licensed User
Longtime User
Hi,
I just try to use your program as a first step for creating own ioio-applications.
It did not work.
I couldn't find the "AndroidManifest.xml File" and don't know where the project's root is.
I found under "Project" a "Manifest Editor", where you can only change one file and added under
"Add Manifest text" what you wrote.
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>)
But trying to compile I see:
Parsing code. Error
Error parsing program.
Error description: Unknown type: ioio
Are you missing a library reference?
Occurred on line: 34
Dim YOYO As IOIO

Can you help me?

The post you are replying to is nearly 3 years old! Things have changed since then. See this post.
Download the library and workbench app zip files. Put the library in the additional libraries folder and the app in a folder of your choice. Open the workbench app in B4A and compile. If B4A is setup correctly, it should be as easy as that to get started.
 

Fossil

Member
Licensed User
Longtime User
The post you are replying to is nearly 3 years old! Things have changed since then. See this post.
Download the library and workbench app zip files. Put the library in the additional libraries folder and the app in a folder of your choice. Open the workbench app in B4A and compile. If B4A is setup correctly, it should be as easy as that to get started.
Many thanks for your quick replies, Erel and kolbe,
I tried to do what you told me (I think it was not the same from both of you:eek:) and am very sad there is no success.
I downloaded the workbench 2.02 zip and started it, controlled the libraries (there are ioiobt version 1.61 and ioiolibbt in my list) and added "AddPermission(android.permission.INTERNET)" in the Manifest Editor. I still have a similar error when trying to compile:
Parsing code. Error
Error parsing program.
Error description: Unknown type: ioio
Are you missing a library reference?
Occurred on line: 43
Dim ioio1, ioio2, ioio3 As IOIO
I fear I am too stupid for this :( but would be very thankful if you give me another try:)??
 

kolbe

Active Member
Licensed User
Longtime User
Many thanks for your quick replies, Erel and kolbe,
I tried to do what you told me (I think it was not the same from both of you:eek:) and am very sad there is no success.
I downloaded the workbench 2.02 zip and started it, controlled the libraries (there are ioiobt version 1.61 and ioiolibbt in my list) and added "AddPermission(android.permission.INTERNET)" in the Manifest Editor. I still have a similar error when trying to compile:
Parsing code. Error
Error parsing program.
Error description: Unknown type: ioio
Are you missing a library reference?
Occurred on line: 43
Dim ioio1, ioio2, ioio3 As IOIO
I fear I am too stupid for this :( but would be very thankful if you give me another try:)??

"ioiobt" is an old library you need the simple "ioio" one. Go to your additional library folder and delete all the ioio related jar and xml files. Recopy the ioio.jar and ioio.xml that you downloaded from the link above. When you load the app, in the library tab, it should then select the ioio library and once loaded display the version which should be 2.02. If you don't see this something is still wrong with your setup. Look in the forum on how to used additional libraries. The error you are seeing is because the app can't find the correct library to compile against.

You do not need to a use AddPermision with the workbench because all that is needed is already there. This was only the case in the very early libraries. Undo the changes you made to the manifest editor.
 

Fossil

Member
Licensed User
Longtime User
"ioiobt" is an old library you need the simple "ioio" one. Go to your additional library folder and delete all the ioio related jar and xml files. Recopy the ioio.jar and ioio.xml that you downloaded from the link above. When you load the app, in the library tab, it should then select the ioio library and once loaded display the version which should be 2.02. If you don't see this something is still wrong with your setup. Look in the forum on how to used additional libraries. The error you are seeing is because the app can't find the correct library to compile against.

You do not need to a use AddPermision with the workbench because all that is needed is already there. This was only the case in the very early libraries. Undo the changes you made to the manifest editor.
Thank you, I did as you told me but it still doesn´t work, now the error is
Parsing code. 0.00
Compiling code. Error
Error compiling program.
Error description: Unknown member: waitforconnect
Occurred on line: 51
YOYO.WaitForConnect()
Word: waitforconnect
 

luigi.crocella

Member
Licensed User
Longtime User
Hello to all,
today I received my IOIO board!
I followed all the instructions. I connect with a cable to usb otg tablet and the red LED lights up.

As the first test I thought about using workbench 232 with the library ioio202.
My problem comes when I try to compile the ioio workbench 232, shows:

Parsing code. 0.05
Compiling code. Error
Impossibile leggere oltre la fine del flusso.

if i try to open the designer shows:

An error occurred.
Error loading file.
Impossibile leggere oltre la fine del flusso.

If i try again after load 'main.bal', shows:
Generata eccezione di tipo 'OutOfMemoryException'.

What happens?Help
 

kolbe

Active Member
Licensed User
Longtime User
Thank you, I did as you told me but it still doesn´t work, now the error is
Parsing code. 0.00
Compiling code. Error
Error compiling program.
Error description: Unknown member: waitforconnect
Occurred on line: 51
YOYO.WaitForConnect()
Word: waitforconnect

I'm a bit confused as to what you are trying to do.

You said you are trying to compile the workebench app but the current workbench app does not use waitforconnect. This method has been replaced by the connect method which workbench does use. You can't compile old code (intended for an older version of the library) with a new library or vice versa.

If you compile the latest version of workbench with the latest version of the library all should work.
 

kolbe

Active Member
Licensed User
Longtime User
Hello to all,
today I received my IOIO board!
I followed all the instructions. I connect with a cable to usb otg tablet and the red LED lights up.

As the first test I thought about using workbench 232 with the library ioio202.
My problem comes when I try to compile the ioio workbench 232, shows:

Parsing code. 0.05
Compiling code. Error
Impossibile leggere oltre la fine del flusso.

if i try to open the designer shows:

An error occurred.
Error loading file.
Impossibile leggere oltre la fine del flusso.

If i try again after load 'main.bal', shows:
Generata eccezione di tipo 'OutOfMemoryException'.

What happens?Help

Are you able to compile non IOIO applications??
Do you see the IOIO library in the library tab? What version is being reported?
 

Fossil

Member
Licensed User
Longtime User
I'm a bit confused as to what you are trying to do.

You said you are trying to compile the workebench app but the current workbench app does not use waitforconnect. This method has been replaced by the connect method which workbench does use. You can't compile old code (intended for an older version of the library) with a new library or vice versa.

If you compile the latest version of workbench with the latest version of the library all should work.
Workbench 2.3 with library ioio2.02 and dialogs2.92. I am trying to start my first ioio-program with all this problems. Where from should I know which versions of different parts of the system belong together or are even compatible? In the tutorial I read I have to use API 8. Is this also wrong? The actual version is I think 16.
Error:
Parsing code. 0.02
Compiling code. 0.04
Compiling layouts code. 0.01
Generating R file. 0.03
Compiling debugger engine code. Error
java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main" Could not find the main class: com.sun.tools.javac.Main. Program will exit.
 
Last edited:
Top