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:

cmartins

Member
Licensed User
Longtime User
waitForValue() method

Agraham,

Me again!

I am creating a project to read a RPM from cooler. there are two states open or close (0 or 1). the problem when the cooler is running slow there are more counts until the circuit close, then I create this code below to count only one tick until the circuit close.

Sub timer1_Tick
If rpm.Read() = True AND state = False Then
rpmCount = rpmCount + 1
state = True
End If

If rpm.Read() = False AND state = True Then
state = False
End If

End Sub



there are a waitForValue() method in IOIO docs Wiki: 'Digital I/O' for ytai's IOIO – Codaset and a think is better than my method. :D


may you implement something like in B4PPC?

i.e

Serial.EnableOnComm = True / Sub serial_OnCom - B4PPC


B4Android:

RPM.waitForValue = True
.
.
.
.
Sub RPM_waitForValue

rpmCount = rpmCount + 1

end sub

thanks a lot
 

agraham

Expert
Licensed User
Longtime User
If you used waitForValue in your normal Basic4android program it would block the main thread and Android would kill your app. It could only be used in a thread other than the main thread and even then would block that thread so I chose not to include it in the library because the prospect of misusing it in a normal single threaded program is too high.
 

cmartins

Member
Licensed User
Longtime User
Agraham,

Do you have any suggestion to control more precisely these fast digital inputs?


thanks
 

Ph1lJ

Member
Licensed User
Longtime User
Has anyone got the ioio to work with Galaxy Tab

Got an ioio yesterday - downloaded the ioiodemo app - plugged in the ioio board the Tab asked for a usb connection - anyone got any ideas ?
All the Tab says is that it is 'Waiting for IDE debugger to connect'

The Bridge is connected however
 
Last edited:

agraham

Expert
Licensed User
Longtime User
the Tab asked for a usb connection
This tells us nothing, what is the actual message? Have you enabled USB debugging in Setting -> application -> Development? It's probably waiting for the debugger as a side effect of whatever the USB problem is as it may be stuck in a IOIO call. Uncheck Project -> Attach Debugger in the IDE until you sort the problem out.
 

Ph1lJ

Member
Licensed User
Longtime User
OK - forgot to enable the USB debugging on the Tablet.
All seems good now

Thanks for you response

Cheers
 

henrik

Member
Licensed User
Longtime User
Hi,

I would like to ask for help related to "getting started" with the IOIO.

I'm trying the example from geoffcwicks, but during main_activity_create I
get:

ioio.lib.api.exeption
ConnectionLostException: java.net
SocketException: permission denied

It seem to be related to this "android.permission.INTERNET", but I'm already using the Version 1.1 (so no additional changes in the xml)

USB-Debugging is activated.
The device is a Galaxy Tab.

I've no idea what i could test/check furthermore!?


Thank's in advance !


Best regards,
henrik
 

Ph1lJ

Member
Licensed User
Longtime User
Are you using the Bridge feature - just wondered if you are still conneced.
 

henrik

Member
Licensed User
Longtime User
Hi,

I would like to ask for help related to "getting started" with the IOIO.

I'm trying the example from geoffcwicks, but during main_activity_create I
get:

ioio.lib.api.exeption
ConnectionLostException: java.net
SocketException: permission denied

......

When I modify the xml-file everything works fine.
I posted my request before checking it carefully.

What I thought was, that the problem with the permission is solved when version 1.1 is used.
Just for better unerstanding: why isn't it like that?
 

agraham

Expert
Licensed User
Longtime User
What I thought was, that the problem with the permission is solved when version 1.1 is used.
Just for better unerstanding: why isn't it like that?
It shouldn't be necessary to add the Internet permission, it gets added fine for me. I've have no idea as to why it didn't get added for you. Does the Libs pane in the the IDE show version 1.1?
 

henrik

Member
Licensed User
Longtime User
It shouldn't be necessary to add the Internet permission, it gets added fine for me. I've have no idea as to why it didn't get added for you. Does the Libs pane in the the IDE show version 1.1?

There i find 1.00 ... I have overlooked this ! (...my goodness)

So apparently I have a mismatch with the versions.
Can't see why right now, but I have to find.

Thanks.
 

agraham

Expert
Licensed User
Longtime User
Version 1.2 now posted includes a PulseInput object. I haven't been able to test this but as, like the entire library, it is a very thin wrapper over the actual IOIO library it's probably OK.

Note that a pin Mode parameter has been added to OpenPwmOutput so if previous code used this method it will break unless modified.
 

agraham

Expert
Licensed User
Longtime User
Version 1.3 now posted has support for SPI and I2C by the SpiMaster and TwiMaster objects. Totally untested but being a very thin wrapper over the IOIO library it's probably OK. The Status properties for use with WriteReadAsync are the only things that might be broken.
 
Top