UART Best Practices?

58 views
Skip to first unread message

Kevin Miller

unread,
Oct 5, 2016, 5:52:25 PM10/5/16
to ioio-users
I'm connecting a IOIO to a hobbyist robot which also has a UART. I plan to use the IOIOService because there will be other sensors attached to the IOIO by UART and I want to be able to handle I/O in a timely manner. Is there a full, simple example of using a UART (or 2) in a service? I have several questions:

1. If there is a temporary loss of connection, say a Bluetooth hiccup, what disconnected() do with the UARTs? There may be data in the buffers, will it be lost? Will the uart created by openUart() be destroyed/undefined? Should the setup() skip openUart() if it was opened in a previous setup()?

Thanks,
Kevin

Ytai Ben-Tsvi

unread,
Oct 9, 2016, 11:44:00 PM10/9/16
to ioio-...@googlegroups.com
Hey, see inline.

On Wed, Oct 5, 2016 at 2:52 PM, Kevin Miller <ksmil...@gmail.com> wrote:
I'm connecting a IOIO to a hobbyist robot which also has a UART. I plan to use the IOIOService because there will be other sensors attached to the IOIO by UART and I want to be able to handle I/O in a timely manner. Is there a full, simple example of using a UART (or 2) in a service?

Not that I'm aware of, but there's not much to it. If you look at the HelloIOIOService example app together with the UART JavaDocs and/or wiki page, you should be able to get going fairly easily (at least as far as using the UART).
 
I have several questions:

1. If there is a temporary loss of connection, say a Bluetooth hiccup, what disconnected() do with the UARTs? There may be data in the buffers, will it be lost? Will the uart created by openUart() be destroyed/undefined?

Upon disconnect, the IOIO instance and all the interfaces created from it (Uart included) become invalid. If there's any unread data it will be lost.
 
Should the setup() skip openUart() if it was opened in a previous setup()?

No. The next setup() gets a fresh instance of the IOIO, that is, it start from a clean state again.
 

Thanks,
Kevin

--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+unsubscribe@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Kevin Miller

unread,
Oct 11, 2016, 5:22:36 PM10/11/16
to ioio-users
Based upon your suggestions, I made a demo that I plan to use as a basis for my next project. Comments/suggestions welcome. It is here: https://github.com/ksmiller99/HelloIOIOUart
Reply all
Reply to author
Forward
0 new messages