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:

bluedude

Well-Known Member
Licensed User
Longtime User
Now that ytai is in here too I will consider buying the IOIO stuff. I was actually looking into Seeedstudio's ADK stuff but if the B4A IOIO is updated and maintained by sir agraham I will start using the IOIO stuff soon.

Cheers,
 

kolbe

Active Member
Licensed User
Longtime User
Just wanted to thank Ytai and agraham for this board and B4a support respectively. With an archos 28 ($80) and the IOIO you can do some seriously cool things cheap. I've used the digital in/out, the pulse in/out, and the TWI without a single problem. Good work. Thanks again. I'm dying to try bluetooth but don't have a second IOIO to program the bootloader. :BangHead:
 

Ph1lJ

Member
Licensed User
Longtime User
Problem using ioio on Android 3.2 Thrive Tablet

Hi
I can successfully upload, the ioio demo program - it launches but sits there telling me it's waiting for IDE debugger to connect, I'm using the bridge to download, if I disable the debugger - then the demo sits there with a blank screen (just title block).

I have used the attached ioio on a 2.2 tablet and all is well.

I'm using usb connection, the usb debugging is enabled allong with stay awake.

The ioio is v1.4 & ioiolib is 3.2

Anyone got any ideas ?
 

agraham

Expert
Licensed User
Longtime User
It seems that not all devices can drive a IOIO. My ZTE Blade/San Francisco can't but my Xoom can. My guess is it's something to do with the adb daemon on the device which IOIO uses to communicate. A Bluetooth IOIO connection might work if the USB one doesn't.
 

pinoy_ako

Member
Licensed User
Longtime User
true.
1. not all android units will support ioio. you can check it on one thread on the ioio user google group for list of supported/unsupported android device.
2. iirc, ioio got issue on some android 2.2 devices.

now let me share you one project i just finished with ioio and agraham's ioiobt lib. here is the video:
http://www.youtube.com/watch?v=iM6WCHyYMHw

the mobot mouse is using ioio bluetooth. i still need to work on having the image viewed on my android. i just don't know if my code is wrong. or my phone doesn't support it.:D
 
Last edited:

tonghl

New Member
Licensed User
Longtime User
IOIOBT1.5 Sample

Hi,

Does anyone has a working IOIO BT Sample Program?

:sign0163:
 

diego

Member
Licensed User
Longtime User
awesome, pinoy_ako ! :sign0098:

I've just received a IOIO board and I want to read a sensor (inductive), but I'm quite lost, I can't find in the documentation how to read the data: should I just use digitalInput.Read in a Timer ?

Or perhaps I need to send a value to the serial port and then read it? Do I need Serial library or IOIO library can do this?

many questions... :sign0013:
 

diego

Member
Licensed User
Longtime User
The sensor is inductive, with positive and negative. I could make it work with Arduino (negative to ground - resistor - input pin, and positive to 5V) and Basic4ppc, using Serial library.

Now I wanted it to work in Android, but I don't know how to start. The behavior should be similar to a switch, giving a "HIGH" if the circuit is closed, and "LOW" if it is opened.

In my first tests with Arduino I could test the program without the sensor, just crossing two cables or using a push-button switch.
 

pinoy_ako

Member
Licensed User
Longtime User
since what you gave is terminal of your sensor (gnd, resistor, 5v),
i may assume the output of your sensor is open collector or 5v. you may connect this sensor output to 5v tolerant pin of ioio to be safe.
 

diego

Member
Licensed User
Longtime User
Ok, thanks for the advice, since the sensor is powered by the IOIO itself, I'll connect it to the 5V output and pin 3 for example.

What about the code?
 

Timmay

Member
Licensed User
Longtime User
Hi. I'm new to Basic and Android programming. I'm trying to get analog input (AI) data from a ioio over Bluetooth. I'm using pinoy_ako's Bluetooth app above. I've added in code which is polling the AI value every second.
I think there's something wrong with my analog input syntax.
My code is below. What has been changed from pinoy_ako's code is in bold. The part in bold itallics is causing an error when I run the app on the phone.
'Activity module
Sub Process_Globals
Dim YOYO As IOIOBT
Dim led As DigitalOutput
Dim Ana As AnalogInput
Dim timer1 As Timer
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim btnLED As ToggleButton
Dim Label1 As Label
Dim freq As Int 'sampling rate, 1000=1sec
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
activity.AddMenuItem("Connect","Connect")
activity.AddMenuItem("Disconnect","Disconnect")
freq = 1000
timer1.Initialize("Timer1", freq)
timer1.Enabled = True

End Sub

Sub Connect_Click
YOYO.Initialize(True)
YOYO.WaitForConnect()
led = YOYO.OpenDigitalOutput(0,led.OP_NORMAL ,True) ' Enable LED_PIN for output
led.Write(True)
Ana = YOYO.OpenAnalogInput(34)
ToastMessageShow("Library Version: " & YOYo.GetIOIOVersion(YOYO.VER_IOIOLIB),True)
ToastMessageShow("Bootloader Version: " & YOYo.GetIOIOVersion(YOYO.VER_BOOTLOADER),True)
ToastMessageShow("Firmware Version: " & YOYo.GetIOIOVersion(YOYO.VER_FIRMWARE),True)
ToastMessageShow("Hardware Version: " & YOYo.GetIOIOVersion(YOYO.VER_HARDWARE),True)
ToastMessageShow("IOIObt Connected",False)
End Sub

Sub timer1_Tick
time1 = DateTime.Time(DateTime.Now)
date1 = DateTime.Date(DateTime.Now)
Label1.Text = Ana.Voltage
End Sub


Sub Disconnect_Click
YOYO.Disconnect
yoyo.WaitForDisconnect()
ToastMessageShow("It's now safe to disconnect ioio", False)
End Sub


Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub btnLED_CheckedChange(Checked As Boolean)
led.Write(Not(btnLED.Checked)) ' Turn on/off stat LED, active LOW
End Sub
 
Last edited:

tonghl

New Member
Licensed User
Longtime User
IOIOB4ADemoBT Sample

Thank you pinoy_ako!

I have based on pinoy_ako sample program to create this IOIO Bluetooth sample.

Please remember to copy the following into your lib directory :
1. IOIOBT.jar
2. IOIOBT.xml
3. IOIOlibBT.jar
4. IOIOlibBT.xml

Lib path : C:\Program Files\Anywhere Software\Basic4android\Libraries
 

Attachments

  • IOIOB4ADemoBT.zip
    7.7 KB · Views: 294
Top