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

macsboost

Member
Licensed User
Longtime User
The examples posted seem to be for the earlier ioio libraries. I have been experimenting with the ioio workshop as an example as it compiles with the newer libraries, but am having difficulty modifying the code to connect automatically and read the analogs based on a timer.

Trying to automate the connection process seems to work button based but when forcing the button action at run time seems to break the connection.

Can you help with a basic example that tries to connect automatically and read an analog input on a timer.

The latest libraries seem to support multiple "threads" or simultaneous requests based on the workshop examples. So that would help with looking at multiple analog pins. 5hz is fine, but the ability to oversample to improve tha accuracy would be nice.

A picaxe analog to i2c is an option, I would just like to try the ioio mint on its own first.

Your help is greatly appreciated.
 

kolbe

Active Member
Licensed User
Longtime User
The examples posted seem to be for the earlier ioio libraries. I have been experimenting with the ioio workshop as an example as it compiles with the newer libraries, but am having difficulty modifying the code to connect automatically and read the analogs based on a timer.

Trying to automate the connection process seems to work button based but when forcing the button action at run time seems to break the connection.

Can you help with a basic example that tries to connect automatically and read an analog input on a timer.

The latest libraries seem to support multiple "threads" or simultaneous requests based on the workshop examples. So that would help with looking at multiple analog pins. 5hz is fine, but the ability to oversample to improve tha accuracy would be nice.

A picaxe analog to i2c is an option, I would just like to try the ioio mint on its own first.

Your help is greatly appreciated.

True, the best up to date examples are in the latest IOIO workshop.

Allow me to explain the threads idea. True that the different IOIO methods run on a different thread than the GUI and that these if called fast enough could offer a simultaneous like operation but in the end the IOIO can only do one thing at a time and more importantly it receives the commands from the android device synchronously. The fact that there are multiple threads on the android device running at once just means that they are queuing up to be sent to the IOIO.

As for connecting, I usually call connect straight off and wait for the connect event to return. You can then optionally query the connection state on a timer and reconnect if needed. Once the connect event is raised you can also start your timer to gather data. Checking the connection state before accessing the IOIO helps too. You can also use try/catch to handled the unexpected. I generally call disconnect before trying to reconnect the IOIO. I'll see about an example in the next few days.
 

macsboost

Member
Licensed User
Longtime User
Thanks for the tips and info. An example will be greatly appreciated. Thank you for your time.
 

mrodriguez

Member
Licensed User
Longtime User

petrbury

Member
Licensed User
Longtime User
Hi,
I´m using IOIO for some time (thank You Agraham and Kolbe) with several different devices.
But now I need to use it with tablet Acer Iconia B1 and it doesn´t work over Bluetooth.
Bluetooth dongle is paired with this tablet OK. In Workbench 2.0 it can see paired IOIO (button "BT Pairs ?"), but attempt to connect it via BT gives a message :

java.io.IOException:[JSR82] connect:Connection is not created (failed or aborted]. IOIO1 State : DEAD.

Over USB it works.
BT keyboard works with this tablet OK.
Am I missing anything?
Thanks for any idea.
Petr
 

mrodriguez

Member
Licensed User
Longtime User
Any idea when release ioio over open accessory?
There is a bug on android 4.2 when using bluetooth + wifi (it drops) so I need to work over usb.
Regards
 

kolbe

Active Member
Licensed User
Longtime User
Does your IOIO work with the precompiled app that Ytai provides. This is a good place to start because not all BT dongles work with the IOIO. Just because it pairs does not mean it works with the IOIO. Scan through the IOIO-users google groups to see which dongles work. If your BT works with the precompiled app then try this code and see if you can connect.

Hi,
I´m using IOIO for some time (thank You Agraham and Kolbe) with several different devices.
But now I need to use it with tablet Acer Iconia B1 and it doesn´t work over Bluetooth.
Bluetooth dongle is paired with this tablet OK. In Workbench 2.0 it can see paired IOIO (button "BT Pairs ?"), but attempt to connect it via BT gives a message :

java.io.IOException:[JSR82] connect:Connection is not created (failed or aborted]. IOIO1 State : DEAD.

Over USB it works.
BT keyboard works with this tablet OK.
Am I missing anything?
Thanks for any idea.
Petr
 

kolbe

Active Member
Licensed User
Longtime User
I don't have enough free time to work on this as of late. I hope to have more time by years end. I haven't given up on this I just need the time to educate myself on Open Accessory, it's complexities have thus far eluded me. Furthermore, since a BT connection suits my projects just fine it is also not high on the priority list.

Any idea when release ioio over open accessory?
There is a bug on android 4.2 when using bluetooth + wifi (it drops) so I need to work over usb.
Regards
 

mrodriguez

Member
Licensed User
Longtime User
I don't have enough free time to work on this as of late. I hope to have more time by years end. I haven't given up on this I just need the time to educate myself on Open Accessory, it's complexities have thus far eluded me. Furthermore, since a BT connection suits my projects just fine it is also not high on the priority list.

Kolbe we can maintain the library together, I have time to do it.
I have been working with a high skill chinese guy that can upgrade it to Open Accessory. At least try.
Thanks
 
Last edited:

petrbury

Member
Licensed User
Longtime User
Does your IOIO work with the precompiled app that Ytai provides. This is a good place to start because not all BT dongles work with the IOIO. Just because it pairs does not mean it works with the IOIO. Scan through the IOIO-users google groups to see which dongles work. If your BT works with the precompiled app then try this code and see if you can connect.

Thanks for response. I don't think it's connected with dongle. I tried 3 different dongles with the same result. All this three dongles work OK with IOIO on other devices (Nexus 7, Huawei Ascend G300 and Samsung S5 Wifi). I suppose, that the problem is somewhere in tablet Acer Iconia B1, but I don't have any idea what to try. Maybe I should change some settings on tablet, maybe this tablet is unable to work with IOIO through the BT, I don't know.
Anyway if somebody could give me some tip what to do I would appreciate it.

Petr
 

kolbe

Active Member
Licensed User
Longtime User
Thanks for response. I don't think it's connected with dongle. I tried 3 different dongles with the same result. All this three dongles work OK with IOIO on other devices (Nexus 7, Huawei Ascend G300 and Samsung S5 Wifi). I suppose, that the problem is somewhere in tablet Acer Iconia B1, but I don't have any idea what to try. Maybe I should change some settings on tablet, maybe this tablet is unable to work with IOIO through the BT, I don't know.
Anyway if somebody could give me some tip what to do I would appreciate it.

Petr

That is important information you left out... if I understand correctly the dongle works fine with the IOIO on other devices but not the Iconia. Going back to the original post, does it work with the precompiled app that Ytai provides in the GitHub download section? If it doesn't work with that app then it's nothing to do with the B4A library. Also did you try the code in post #217 as I suggested? Answers to these two questions will help narrow down where the problem is.
 

petrbury

Member
Licensed User
Longtime User
That is important information you left out... if I understand correctly the dongle works fine with the IOIO on other devices but not the Iconia. Going back to the original post, does it work with the precompiled app that Ytai provides in the GitHub download section? If it doesn't work with that app then it's nothing to do with the B4A library. Also did you try the code in post #217 as I suggested? Answers to these two questions will help narrow down where the problem is.
Sorry, I'm not sure what precompiled application from Ytai should I try. Do You mean some SW for Android, which is using IOIO over BT? I tried to find it in Github.com with no success. And on post #217 there is a file named "ioio test.zip". After unzipping there are two files ioio.jar and ioio.xml - should I copy it to Libraries directory on B4A and try to run my SW with them? Sorry for this silly questions but I'm no software guru.
Thanks Petr
 

kolbe

Active Member
Licensed User
Longtime User
Sorry, I'm not sure what precompiled application from Ytai should I try. Do You mean some SW for Android, which is using IOIO over BT? I tried to find it in Github.com with no success. And on post #217 there is a file named "ioio test.zip". After unzipping there are two files ioio.jar and ioio.xml - should I copy it to Libraries directory on B4A and try to run my SW with them? Sorry for this silly questions but I'm no software guru.
Thanks Petr

Here are the apps I talked about. If you download the application firmware zip from the IOIO Github they are in there. These are compiled straight from java. These are for version 4.00 so if your IOIO is not the same version you need to get the correct one.

The jar and xml files go in your additional libraries directory, they are the IOIO library files. You might want to rename them as to not copy over the older version you have. Try the line below to connect to bluetooth. I know bluetooth is set to false but try it anyway and see if it works.

yoyo.Connect("yoyo",False,1,0)
 

Attachments

  • HelloIOIO.apk
    56.2 KB · Views: 131
  • IOIOSimpleApp.apk
    73.9 KB · Views: 134

petrbury

Member
Licensed User
Longtime User
Here are the apps I talked about. If you download the application firmware zip from the IOIO Github they are in there. These are compiled straight from java. These are for version 4.00 so if your IOIO is not the same version you need to get the correct one.

The jar and xml files go in your additional libraries directory, they are the IOIO library files. You might want to rename them as to not copy over the older version you have. Try the line below to connect to bluetooth. I know bluetooth is set to false but try it anyway and see if it works.

yoyo.Connect("yoyo",False,1,0)

Well, I tried it, both applications work Ok through the USB. Command "yoyo.Connect("yoyo",False,1,0)" didn't help.
I searched again on Google and after all I found the answer (but not solution). It seems, that Acer Iconia B1 supports only A2DP stereo headset through the BT. So the problem is really in my tablet, not on Your library.

Thank You very much for your patience.

Petr
 

Cableguy

Expert
Licensed User
Longtime User
Só, i just bought the otg version of the ioio board, and my first project is going to be a complex one.
I am to build a 4x4x4 3d led cube.
I need some pointers on basic electronic connections needed ( is, power supply, etc) and which library should I work with.

Thanks guys
 

kolbe

Active Member
Licensed User
Longtime User
Só, i just bought the otg version of the ioio board, and my first project is going to be a complex one.
I am to build a 4x4x4 3d led cube.
I need some pointers on basic electronic connections needed ( is, power supply, etc) and which library should I work with.

Thanks guys

Best thing is to read the IOIO github carefully. It will give you all the pointers you need to get started, power specs, different functionality, etc. Also read the ioio users google group. Ytai explains a problem with the voltage converter on the OTG that you should be aware about... no long power cables with Vin above 10v. I don't know how much hardware experience you have but I usually break up complex projects into simpler pieces, tests the pieces and then start putting the pieces together. You can get a lot of ideas and help reading all the arduino projects explained in various places on the net.

The latest library is v1.9, the link is on the first post. I include a workbench app that gives a good idea on how to use the library and all the IOIO functionality. If you have Android 4.2 or higher you are limited to a BT connection. Hope to get the OpenAccessory connection working eventually.
 

Cableguy

Expert
Licensed User
Longtime User
Thanks for the pointers...
For the moment I have 2 maybe 3 projects in mind...
A 4x4x4 white LED cube, which I hope to learn from to eventually do a 10x10x10 rgb one
A micro-form factor CNC for PCB routing
And the most ambitious one, a roomba like robot... To help around the house

I am still battering hardware components at the time, and the holidays are close, so construction is probably only start in january

Again, many thanks... I seem to have some reading to do
 
Top