B4A Library IOIO board library

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.


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

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