B4A Library IOIO board library

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

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.

 

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

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

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

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
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

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: 181
  • IOIOSimpleApp.apk
    73.9 KB · Views: 183

petrbury

Member
Licensed User
Longtime User

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

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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…