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,322
  • IOIO1.4.zip
    100.5 KB · Views: 1,758
Last edited by a moderator:

kolbe

Active Member
Licensed User
Longtime User
Hi guys,

Am I right in assuming that a b4j app can communicate and control an ioio board through Bluetooth!?

If so, what are the steps/libs needed to make it work?

I tried this some time back but BT in b4j is not the same as the one in b4a so never got it to work. I could try revisiting this now that b4j has evolved further.
 

kolbe

Active Member
Licensed User
Longtime User
Hi Kolbe, Hi all, does somebody know the trick to get it working on 'older' devices ?
I have the latest workbench app installed on both a Nexus 5 (2013) running Android 6 AND on a tablet "CONNECT 7 Pro" running Android 4.4.2.
I want to use "open accessories" mode. Developper options and USB debug are OFF in both devices.
When I connect a powered IOIO to the devices, both ask me what app to run, so both recognise there is an open accessories attached.
I choose for the Workbench.
In Workbench, I choose ACCESSORY mode and press the (Dis)connect button.
The NEXUS does it perfect and shows me versions etc.
The 4.4.2 tablet does several attempts but always returns "connection lost"
My question : is there anything else to be installed or changed on the 4.4.2 tablet (or in the workbench app) to get it working ?
(PS, in ADB it can work, but I need accessory mode to charge the tablet ...)
It would great if somebody knew a sollution !
Thanks, Reyes.

I can look into this, I do some version checks maybe some are wrong. Several things have to come together for Accesory to work. Nexus devices seem to work best.
 

kolbe

Active Member
Licensed User
Longtime User
After upgrading the IOIO board to firmware 506 it seems to connect to all my android devices (4.0 , 4.4.2 , 5.1 and 6 ) without troubles ...
506 is a CANDIDATE release ... hope not to find other surprises now.

Didn't follow the thread to the end. Good to hear it worked. Sounds like it was firmware related.
 

kolbe

Active Member
Licensed User
Longtime User
Looks like its about time to update the library. Ytai's library has had some changes but nothing major and no functionality changes just minor things. Kinda busy with other things but it's on the list for this month. All my projects continue to work fine all the way up to Android 6.0.1. After the update I'll see about looking into b4j.
 

kolbe

Active Member
Licensed User
Longtime User
I just uploaded version 2.07 of the IOIO library. It includes the latest commits from Ytai plus a few bug fixes and doc corrections.

For this version your IOIO should be running version 5.06 of the application firmware.

The IOIO has become a solid platform. It offers a unique functionality still today and does what it was designed to do well. Although there isn't a lot of activity it is still being supported by Ytai and I intend to here at B4A as well.
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
with the newcomer B4R, inter-action between IO-IO and Arduino ( hardware based ) should make them a very powerful combo!!!
 

ecastelli201

Member
Licensed User
Longtime User
FYI. Andrew will no longer be supporting this library.

http://www.b4x.com/forum/bugs-wishlist/8774-wish-ioio-support.html#post90055

I'll post the new libraries here. It seems like it is better this way than to have two threads on the forum for the same library.

Version: v2.07 (use this one)

This uses the latest java IOIOlib from Ytai. It includes all the latest bug fixes. Look at the IOIO wiki release notes for more information. There is no new functionality in this version. Your IOIO should be using version 5.06 application firmware. Use the latest bootloader as well.

The IOIO has become a solid platform. It offers a unique functionality still today and does what it was designed to do well. Although there isn't a lot of activity it is still being supported by Ytai and I intend to here at B4A as well.

In the zip file I include files needed for OpenAcc and Device connections.

Please place any IOIO related questions in this thread.​

Version: v2.05 (for reference only)

This version brings heaps of long awaited features. You can now finally connect the IOIO in four ways.​

USB ADB: Possible only on SDK 16 and below. After this release Goggle secured ADB and no support for this connection exists in newer Android versions.

BLUETOOTH: This works on almost all versions of Android that have Bluetooth.

USB OPEN ACCESSORY: This works on SDK 10 and above. Your Android device must however support Open Accessory. Most newer devices do have support. For this to work you need to add items to the manifest file of your app. It also requires a two extra commands in your app to register and unregister a broadcast receiver.

USB DEVICE: Connects the IOIO to your Andorid device as a device. This requires that your Android supports Open_Accessory and OTG. In this mode your Android device powers the IOIO. Make sure the IOIO-OTG is set to Auto and not HOST mode.

There is now a Motor Control Sequencer (aka waveform/pwm sequencer). This is a very cool addition made by Ytai. You need application firmware v5 for this functionality.

There is now a synch() command that allows managing the multi-threaded nature of the Android OS with the synchronous nature of the IOIO.

IOIO.Initialize is now required. It also returns a string indicating which connection types are supported by the Andorid device. This only test software support, your device may still lack the required hardware.

Add the changes to your manifest file with the changes in "add this with manifest editor.txt".

Works with both the original IOIO and the IOIO-OTG.

This version requires that your IOIO be running application firmware v5!

This version is built on Ytai's IOIOlib v5.04

Remaining Issues

The sequencer has trouble closing and reopening if done too rapidly. I don't think this is an b4a library issue but an IOIOlib issue. If you try to reopen and an exception is thrown you will need to unplug and plug back in the IOIO to reconnect unless you are using BT of course.

Finally

Enjoy. Since this takes a dedicated effort to maintain I wouldn't mind hearing about your projects. Also... please study the workbench 2.32 code before posting "how to" questions. I kept the code as simple as possible and you have basic examples on how to do use just about all the functionality of the IOIO.​

Version: v1.9 (for reference only)

Only two noteworthy changes in this version.

Capacitive sensing functionality. A cap-sense input pin can be used to measure capacitance, typically in touch sensing applications. Note that not every pin can be used as cap-sense.

The PulseWidthSweep method. Changes the pulsewidth from pulseWidthStart to pulseWidthEnd by step with a msPause in ms b/w each loop. Step should always be positive. Just make start greater than end to count backwards.
This method is usefull for better control of servos.

Note that this version is built on Ytai's IOIOlib v4.0. This means that the IOIO firmware app needs to be v4.0 too.

Judging from the download there seems to be a least 50 or so of you using the library.​

Version: v1.8 (for reference only)

Many things have changed in this version so be sure to read everything to avoid questions on the forum that are answered in the documentation. Be sure to read the documentation that Ytai provides for the IOIO on github. The latest B4A library is based on the Ytai's 3.26 version.

https://github.com/ytai/ioio/wiki/IOIOLib-Basics

Changes/Improvements

The library now supports connections to multiple IOIOs simultaneously. See the IOIO Workbench app for an example.
Most of the methods are now threaded so it all works with SDK > 9, no more NetworkOnMainThread exceptions.
Documentation improved, examples for most methods.
An IOIO Workbench app to verify most IOIO functionality.
Uses latest code from Ytai, so other bug fixes.

Remaining Issues

Starting with Android 4.1 Google has added encryption to the ADB interface that IOIO uses to communicate when connected through USB. Ytai doesn't have any plans to support this change. Because this version of the library doesn't support OpenAcc, the only way to connect to Android devices 4.1 and higher is via Bluetooth.​

Note:
IOIO Test is for v1.7 of the library
IOIO Workbench 2.0 is for v1.8 of the library
IOIO Workbench 2.1 is for v1.9 of the library
IOIO Workbench 2.32 is for v2.07 of the library

For IOIO Workbench you will need to adapt your screen layout for your device.
 

dnaci

Member
Licensed User
Longtime User
Hello. The error I get is below. What could be the solution. Ican use IOIOB4ADemo.zip files.

B4A version: 6.50
Parsing code. (0.00s)
Compiling code. (0.04s)
Compiling layouts code. (0.02s)
Organizing libraries. (0.01s)
Generating R file. (0.11s)
Compiling debugger engine code. (1.59s)
Compiling generated Java code. (1.79s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lanywheresoftware/b4a/agraham/ioio/B4AIOIO$B4AAnalogueInputWrapper;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:615)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:570)
at com.android.dx.command.dexer.Main.access$2(Main.java:546)
at com.android.dx.command.dexer.Main$2.processFileBytes(Main.java:514)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:537)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:449)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:236)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:179)
at com.android.dx.command.Main.main(Main.java:103)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lioio/lib/api/TwiMaster$Rate;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:615)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:570)
at com.android.dx.command.dexer.Main.access$2(Main.java:546)
at com.android.dx.command.dexer.Main$2.processFileBytes(Main.java:514)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:537)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:449)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:236)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:179)
at com.android.dx.command.Main.main(Main.java:103)
2 errors; aborting
 

Cableguy

Expert
Licensed User
Longtime User
you seem to have 2 ioio lib versions added to your project(?)
the errors are "simply" complaining of already added entries by the lib... so either you still have an older version referenced or existing in the project folder, of there seems to be an inner error on the lib
 

dnaci

Member
Licensed User
Longtime User
Thanks Cableguy. When ioio bt (v1.50) and ioiolibbt(v.3.20) library files are removed from the project, normal compilation is done. I need use bluetooth connection. But what version of bluetootht should I try?
 

sorex

Expert
Licensed User
Longtime User
Did anyone ever succeed to read out a S18D20 temp. sensor via ioio on android?

Or which temp. sensor will work for sure?
 

kolbe

Active Member
Licensed User
Longtime User
Sorry for the delay in replying but don't do much with the IOIO anymore and didn't see the post.

That sensor uses OneWire and as far as I know IOIO can't do Onewire. You should find a sensor that uses i2c or SPI or serial or analog.
 
Top