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

kolbe

Active Member
Licensed User
Longtime User
If the IOIOmint uses the same firmware/IOIOlib that Ytai releases it should be OK but I can't give you a definitive answer because I don't know what all is different on the IOIOmint. You would have to ask the IOIOmint people to see if they use an unaltered version of Ytai's library and firmware.

Koble,

What I mean is if you think the B4A library can run this IOIO mint.

Cheers,
 

leongcc

Member
Licensed User
Longtime User
I got an error 'Service discovery is canceled' at the attempt connect,
B4X:
Dim ioio1 as IOIO
ioio1.Connect("ioio1", True, 1, 0)

My situation:

My existing application uses bluetooth for my other bluetooth devices, that is, the libraries Serial and BluetoothAdmin are already in-use. So when I added codes for IOIO I am using the same Serial and BluetoothAdmin.

Is it possible for My Kolbe to share the codes in IOIO's Connect function ?
So that I can troubleshoot and maybe modify to suit my situation
Thanks
 

kolbe

Active Member
Licensed User
Longtime User
Markon is in the process of setting up a GIT for this library, so shortly the code will be available. In the meantime, can you connect via bluetooth with the workbench app? Is the IOIO paired etc? Also once paired turn off bluetooth discovery.

I got an error 'Service discovery is canceled' at the attempt connect,
B4X:
Dim ioio1 as IOIO
ioio1.Connect("ioio1", True, 1, 0)

My situation:

My existing application uses bluetooth for my other bluetooth devices, that is, the libraries Serial and BluetoothAdmin are already in-use. So when I added codes for IOIO I am using the same Serial and BluetoothAdmin.

Is it possible for My Kolbe to share the codes in IOIO's Connect function ?
So that I can troubleshoot and maybe modify to suit my situation
Thanks
 

engvidal

Member
Licensed User
Longtime User
open event not fou d

Hi

I am trying to use:

dim S1 as digitalInput
...
IOIO.OpenDigitalInput("S1event",19,S1.IP_FLOATING)
...

and I write the sub:
Sub S1event_open(noerror As Boolean,result As Object)....

It compiles OK, initialize, connect via BT, analoginput and digitalOutput initialize ok, but I receive an exception (error) that says:
event S1event_open not found.

I tried everything, but could not find why just this sub XX_open is compiled but not found.

Thank You.

Vidal
 

kolbe

Active Member
Licensed User
Longtime User
Try s1event and not S1event. The event names must be in lowercase.

Hi

I am trying to use:

dim S1 as digitalInput
...
IOIO.OpenDigitalInput("S1event",19,S1.IP_FLOATING)
...

and I write the sub:
Sub S1event_open(noerror As Boolean,result As Object)....

It compiles OK, initialize, connect via BT, analoginput and digitalOutput initialize ok, but I receive an exception (error) that says:
event S1event_open not found.

I tried everything, but could not find why just this sub XX_open is compiled but not found.

Thank You.

Vidal
 

engvidal

Member
Licensed User
Longtime User
Try s1event and not S1event. The event names must be in lowercase.
Thank You veru muck Kolbe

Your mark: "Knoes the basic" is incorrect. Yoy are great.

Is there any more detailed documentation about IOIO and its functions ?

Tahnk You again

Vidal
 

kolbe

Active Member
Licensed User
Longtime User
IOIO library v1.9 posted

See here for latest release.

This time I'll get the the library wiki page updated too.

For those who may not know, you can rename the IOIO.jar and IOIO.xml to IOIO19.jar and IOIO19.xml if you want easy access to several versions at the same time. You obviously can't have several versions checked at the same time in the B4A IDE library tab.
 

kolbe

Active Member
Licensed User
Longtime User
See the links in the above post. The IOIO GitHub has the most detailed info.

Thank You veru muck Kolbe

Your mark: "Knoes the basic" is incorrect. Yoy are great.

Is there any more detailed documentation about IOIO and its functions ?

Tahnk You again

Vidal
 

Stulish

Active Member
Licensed User
Longtime User
I have been trying to get IOIO Workbench to see my IOIO board over USB and Bluetooth and so far have managed to get nowhere.

So i downloaded IOIO Hardware Tester from google play and you can see the screenshot below, it connects fine by Bluetooth (there is no USE test), and i am able to toggle the boards LED on and off.

But when i use IOIO Workbench it just will not connect (see other screen shot)

I have tried it on a NEXUS 7, Galaxy S3 and ASUS Transformer TF101 to no avail.

Any ideas????

Thanks
 

Attachments

  • Screenshot_2013-04-15-23-24-10.jpg
    Screenshot_2013-04-15-23-24-10.jpg
    64.2 KB · Views: 159
  • Screenshot_2013-04-15-23-34-45.jpg
    Screenshot_2013-04-15-23-34-45.jpg
    70.7 KB · Views: 175

Stulish

Active Member
Licensed User
Longtime User
Have managed to sort the problem by updating the firmware to version 4 so it now works with Bluetooth, but i am having no luck with USB connection, It just says 'Attempting USB connection to IOIO1' and the state button says it is at INIT, so any advice is appreciated.
 
Last edited:

kolbe

Active Member
Licensed User
Longtime User
Glad to hear you figured it out. v1.9 requires the app firmware 4.0. This give you capsense! I should probably add a version check in IOIO workbench.

As mentioned as well in the release post, Google added a secure ADB with Android 4.1. The IOIO firmware doesn't support this. It does support OpenAcc but I haven't managed to get it to work. Markon above is taking a look at it too. So for a USB connection at the moment you need to be below Android 4.1.

Have managed to sort the problem by updating the firmware to version 4 so it now works with Bluetooth, but i am having no luck with USB connection, It just says 'Attempting USB connection to IOIO1' and the state button says it is at INIT, so any advice is appreciated.
 

Stulish

Active Member
Licensed User
Longtime User
thanks Kolbe I missed the secure ADB part
 

Stulish

Active Member
Licensed User
Longtime User
I just tried the IOIO with my ASUS eeePad Transformer TF101 this is android v4.0.3 and it works fine over BT but i get the same problem with USB connection.

:(

I need some way of connecting my devices to receive serial data via a cable, for a company who want to use android devices that are fixed into position and they dont want wifi/BT connectivity.

I am also trying the USB/Serial connections but have had little luck with this too (i have an FTDI and a pacific chipset device)

I will just have to keep trying

Regards
 

kolbe

Active Member
Licensed User
Longtime User
Could you send me a log of what is going on? Is there an exception being thrown. I'll double check here. I can send you a log of what should happen.

Stating the obvious, USB debugging has to be on.

  • Did you have USB working with other versions of the library?
  • USB ADB works on the same device with "IOIO Hardware tester"? What does the log look like?
  • Is this the IOIO-OTG of the original IOIO?

I just tried the IOIO with my ASUS eeePad Transformer TF101 this is android v4.0.3 and it works fine over BT but i get the same problem with USB connection.

:(

I need some way of connecting my devices to receive serial data via a cable, for a company who want to use android devices that are fixed into position and they dont want wifi/BT connectivity.

I am also trying the USB/Serial connections but have had little luck with this too (i have an FTDI and a pacific chipset device)

I will just have to keep trying

Regards
 

Stulish

Active Member
Licensed User
Longtime User
Hi Kolbe,

I should have said it is an IOIO-OTG, i only got it this week so have not had a play with one before.

There are no exceptions thrown up while running the app.

I have attached the filtered IOIO log that i saved in the Workbench app, the unfiltered was 274k and was too large to upload onto the forum, the log is also quoted below:

04-16 17:04:44.776 D/IOIOImpl( 6525): Client requested disconnect.
04-16 17:04:44.776 V/SocketIOIOConnection( 6525): Client initiated disconnect
04-16 17:04:44.776 D/IOIOImpl( 6525): Connection lost / aborted
04-16 17:04:44.826 D/IOIOConnectionRegistry( 6525): No runtime support for: ioio.lib.android.accessory.AccessoryConnectionBootstrap. Not adding.
04-16 17:04:44.846 D/IOIOImpl( 6525): Waiting for IOIO connection
04-16 17:04:44.846 V/IOIOImpl( 6525): Waiting for underlying connection
04-16 17:04:44.846 V/SocketIOIOConnection( 6525): Creating server socket
04-16 17:04:44.846 V/SocketIOIOConnection( 6525): Waiting for TCP connection
04-16 17:04:47.176 D/IOIOImpl( 6525): Client requested disconnect.
04-16 17:04:47.176 V/SocketIOIOConnection( 6525): Client initiated disconnect
04-16 17:04:47.176 D/IOIOImpl( 6525): Connection lost / aborted
04-16 17:04:49.196 D/IOIOImpl( 6525): Client requested disconnect.
04-16 17:04:49.256 D/IOIOConnectionRegistry( 6525): No runtime support for: ioio.lib.android.accessory.AccessoryConnectionBootstrap. Not adding.
04-16 17:04:49.276 D/IOIOImpl( 6525): Waiting for IOIO connection
04-16 17:04:49.276 V/IOIOImpl( 6525): Waiting for underlying connection
04-16 17:04:49.276 V/SocketIOIOConnection( 6525): Creating server socket
04-16 17:04:49.276 V/SocketIOIOConnection( 6525): Waiting for TCP connection
04-16 17:04:55.826 D/IOIOImpl( 6525): Client requested disconnect.
04-16 17:04:55.836 V/SocketIOIOConnection( 6525): Client initiated disconnect
04-16 17:04:55.836 D/IOIOImpl( 6525): Connection lost / aborted
04-16 17:05:06.756 D/IOIOImpl( 6525): Client requested disconnect.
04-16 17:05:06.806 D/IOIOConnectionRegistry( 6525): No runtime support for: ioio.lib.android.accessory.AccessoryConnectionBootstrap. Not adding.
04-16 17:05:06.836 D/IOIOImpl( 6525): Waiting for IOIO connection
04-16 17:05:06.836 V/IOIOImpl( 6525): Waiting for underlying connection
04-16 17:05:06.836 V/BluetoothIOIOConnection( 6525): Attempting to connect to Bluetooth device: IOIO (BF:EB)
04-16 17:05:08.146 V/BluetoothIOIOConnection( 6525): Established connection to device IOIO (BF:EB) address: 00:15:83:0C:BF:EB
04-16 17:05:08.146 V/IOIOImpl( 6525): Waiting for handshake
04-16 17:05:08.166 I/IncomingState( 6525): IOIO Connection established. Hardware ID: SPRK0020 Bootloader ID: IOIO0400 Firmware ID: IOIO0400
04-16 17:05:08.166 V/IOIOImpl( 6525): Querying for required interface ID
04-16 17:05:08.196 V/IOIOImpl( 6525): Required interface ID is supported
04-16 17:05:08.196 I/IOIOImpl( 6525): IOIO connection established
04-16 18:43:39.186 D/IOIOImpl( 6525): Client requested disconnect.
04-16 18:43:39.186 V/BluetoothIOIOConnection( 6525): Client initiated disconnect
04-16 18:43:39.186 I/IOIOProtocol( 6525): IOIO disconnected
04-16 18:43:39.246 D/IOIOConnectionRegistry( 6525): No runtime support for: ioio.lib.android.accessory.AccessoryConnectionBootstrap. Not adding.
04-16 18:43:39.276 D/IOIOImpl( 6525): Waiting for IOIO connection
04-16 18:43:39.276 V/IOIOImpl( 6525): Waiting for underlying connection
04-16 18:43:39.276 V/SocketIOIOConnection( 6525): Creating server socket
04-16 18:43:39.276 V/SocketIOIOConnection( 6525): Waiting for TCP connection
1862 Logs -- 39 Matched -- Log size 265 KB

i have also attached a screen shot of the TF101 screen, basically it just seems to sit there waiting for a reply if i click the 'state?' button it says INIT.

I have USB Debugging on and i haven't tried it with any previous versions of the library.

The IOIO Hardware tester app only seems to use BT, it doesn't show anything if plugged into USB.

I hope that info is useful, let me know if you need anything else

Regards (and thanks for all your collective work on the library)

Stu
 

Attachments

  • Screenshot tf101.JPG
    Screenshot tf101.JPG
    44.2 KB · Views: 155
  • filtered_ioio_log[1].txt
    3.2 KB · Views: 169
Last edited:

kolbe

Active Member
Licensed User
Longtime User
Just tried it on Android 3.2 and it worked fine. Below is the log. Other than that I only have a 4.2.2 device. Maybe something else changed in Android 4.0. At this point I need a log of what is happening to get an idea of the problem.

04-16 19:39:01.880 D/IOIOConnectionRegistry( 6493): Successfully added bootstrap class: ioio.lib.impl.SocketIOIOConnectionBootstrap
04-16 19:39:01.880 D/IOIOConnectionRegistry( 6493): Successfully added bootstrap class: ioio.lib.android.bluetooth.BluetoothIOIOConnectionBootstrap
04-16 19:39:01.900 D/IOIOConnectionRegistry( 6493): No runtime support for: ioio.lib.android.accessory.AccessoryConnectionBootstrap. Not adding.
04-16 19:39:01.940 D/IOIOImpl( 6493): Waiting for IOIO connection
04-16 19:39:01.940 V/IOIOImpl( 6493): Waiting for underlying connection
04-16 19:39:01.940 V/SocketIOIOConnection( 6493): Creating server socket
04-16 19:39:01.940 V/SocketIOIOConnection( 6493): Waiting for TCP connection
04-16 19:39:01.940 V/SocketIOIOConnection( 6493): TCP connected
04-16 19:39:01.940 V/IOIOImpl( 6493): Waiting for handshake
04-16 19:39:01.940 I/IncomingState( 6493): IOIO Connection established. Hardware ID: SPRK0016 Bootloader ID: IOIO0311 Firmware ID: IOIO0400
04-16 19:39:01.950 V/IOIOImpl( 6493): Querying for required interface ID
04-16 19:39:01.950 V/IOIOImpl( 6493): Required interface ID is supported
04-16 19:39:01.950 I/IOIOImpl( 6493): IOIO connection established
 
Last edited:

kolbe

Active Member
Licensed User
Longtime User
So it looks like it can't establish a TCP connection... odd. Because it is the OTG it is a different bootloader than I have and that may make a difference. I hope to have an OTG by the end of the week.

In the meantime try forcing the HOST mode on the IOIO-OTG.

If that doesn't work then try this library. Turn off BT on the device because it will connect to the first available connection it finds.

Also could you see in the logs if you see the SocketIOIOI bootstrap being loaded. I didn't see it in your log but that is probably because it was done earlier. It only happens once.

D/IOIOConnectionRegistry( 6493): Successfully added bootstrap class: ioio.lib.impl.SocketIOIOConnectionBootstrap
 

Attachments

  • ioio test.zip
    206.8 KB · Views: 208
Last edited:

Stulish

Active Member
Licensed User
Longtime User
Great work,

I just used the library in the last post and USB is now connecting and i can turn the LED on/off

:)

Thanks

Do you still need any logs or anything?

Stu
 

kolbe

Active Member
Licensed User
Longtime User
Yes, could you get a log with it working. If you could get it from when ioio workbench is first created and catch the bootstraps being loaded that would be great.

Just remember with that library when you select through USB, it may still connect via BT if it is available. Once I get an IOIO-OTG I'll figure the details out.

Great work,

I just used the library in the last post and USB is now connecting and i can turn the LED on/off

:)

Thanks

Do you still need any logs or anything?

Stu
 

Stulish

Active Member
Licensed User
Longtime User
Kolbe,

Below is the filtered log from just opening the app and then pressing connect, not bluetooth was on and it connected correctly:

04-17 14:28:59.126 D/IOIOConnectionRegistry(15848): Successfully added bootstrap class: ioio.lib.impl.SocketIOIOConnectionBootstrap
04-17 14:28:59.126 D/IOIOConnectionRegistry(15848): Successfully added bootstrap class: ioio.lib.android.bluetooth.BluetoothIOIOConnectionBootstrap
04-17 14:28:59.136 D/IOIOConnectionRegistry(15848): No runtime support for: ioio.lib.android.accessory.AccessoryConnectionBootstrap. Not adding.
04-17 14:28:59.156 D/IOIOImpl(15848): Waiting for IOIO connection
04-17 14:28:59.166 V/IOIOImpl(15848): Waiting for underlying connection
04-17 14:28:59.166 V/SocketIOIOConnection(15848): Creating server socket
04-17 14:28:59.166 V/SocketIOIOConnection(15848): Waiting for TCP connection
04-17 14:28:59.166 V/SocketIOIOCo
5052 Logs -- 8 Matched -- Log size 679 KB

I also cut the quote below from the unfiltered logs (Hopefully it has what you need), i used the same time frame as shown in the filtered log:

04-17 14:28:59.126 D/IOIOConnectionRegistry(15848): Successfully added bootstrap class: ioio.lib.impl.SocketIOIOConnectionBootstrap
04-17 14:28:59.126 D/IOIOConnectionRegistry(15848): Successfully added bootstrap class: ioio.lib.android.bluetooth.BluetoothIOIOConnectionBootstrap
04-17 14:28:59.126 I/dalvikvm(15848): Could not find method com.android.future.usb.UsbManager.openAccessory, referenced from method ioio.lib.android.accessory.AccessoryConnectionBootstrap.openStreams
04-17 14:28:59.126 W/dalvikvm(15848): VFY: unable to resolve virtual method 2564: Lcom/android/future/usb/UsbManager;.openAccessory (Lcom/android/future/usb/UsbAccessory;)Landroid/os/ParcelFileDescriptor;
04-17 14:28:59.126 D/dalvikvm(15848): VFY: replacing opcode 0x6e at 0x000b
04-17 14:28:59.126 I/dalvikvm(15848): Could not find method com.android.future.usb.UsbManager.getInstance, referenced from method ioio.lib.android.accessory.AccessoryConnectionBootstrap.onCreate
04-17 14:28:59.126 W/dalvikvm(15848): VFY: unable to resolve static method 2562: Lcom/android/future/usb/UsbManager;.getInstance (Landroid/content/Context;)Lcom/android/future/usb/UsbManager;
04-17 14:28:59.136 D/dalvikvm(15848): VFY: replacing opcode 0x71 at 0x0009
04-17 14:28:59.136 I/dalvikvm(15848): Could not find method com.android.future.usb.UsbManager.getAccessoryList, referenced from method ioio.lib.android.accessory.AccessoryConnectionBootstrap.open
04-17 14:28:59.136 W/dalvikvm(15848): VFY: unable to resolve virtual method 2561: Lcom/android/future/usb/UsbManager;.getAccessoryList ()[Lcom/android/future/usb/UsbAccessory;
04-17 14:28:59.136 D/dalvikvm(15848): VFY: replacing opcode 0x6e at 0x0012
04-17 14:28:59.136 I/b4a ioio AC(15848): bootstrap
04-17 14:28:59.136 D/IOIOConnectionRegistry(15848): No runtime support for: ioio.lib.android.accessory.AccessoryConnectionBootstrap. Not adding.
04-17 14:28:59.146 W/OpenGLRenderer(15848): Shape round rect too large to be rendered into a texture
04-17 14:28:59.156 D/IOIOImpl(15848): Waiting for IOIO connection
04-17 14:28:59.166 V/IOIOImpl(15848): Waiting for underlying connection
04-17 14:28:59.166 V/SocketIOIOConnection(15848): Creating server socket
04-17 14:28:59.166 V/SocketIOIOConnection(15848): Waiting for TCP connection
04-17 14:28:59.166 V/SocketIOIOConnection(15848): TCP connected
04-17 14:28:59.166 V/IOIOImpl(15848): Waiting for handshake
04-17 14:28:59.166 I/IncomingState(15848): IOIO Connection established. Hardware ID: SPRK0020 Bootloader ID: IOIO0400 Firmware ID: IOIO0400
04-17 14:28:59.176 V/IOIOImpl(15848): Querying for required interface ID
04-17 14:28:59.176 V/IOIOImpl(15848): Required interface ID is supported
04-17 14:28:59.176 I/IOIOImpl(15848): IOIO connection established

Regards

Stu
 
Top