Wow, I can't believe I didn't see that before...I guess I really need to
work on my Java fundamentals. Thanks again, you've really helped me out.
On Thursday, July 30, 2015 at 5:32:36 PM UTC-7, Eric Rule wrote:
>
> Hey all,
>
> Let me know if you've encountered something similar to this:
>
> In my application, I am controlling two IOIO concurrently, but
> independently (one through USB, the other through Bluetooth). I am using
> these two boards to perform I2C reads/writes to two separate devices. All
> of my I2C stuff is working fine, so assume that code is correct.
>
> My goal is to read a register value from the BT devices, and update a
> value on the USB device. I have two IOIOLoopers (one for USB, one for
> Bluetooth), and I want to* first* read the value from the BT board, *then
> *update the value on the USB board (using a simple proportional control
> algorithm). How can I do this correctly? I believe the two Loopers are
> treated as two separate threads and they are running simultaneously? I know
> about the Thread.join() function, but I'm not sure how I can differentiate
> between the two threads in code to make one wait for the other.
>
> Here is a skeleton of my setup (I only have one activity):
>
> public class Main Activity extends IOIOActivity{
>
> onCreate(){
>
> ...
>
> }
>
> class MyBluetoothLooper extends BaseIOIOLooper {
>
>
> void setup(){
>
>
>
> ...
>
>
> }
>
>
>
> void loop(){
>
>
> i2c.read(...);
>
>
>
> Thread.sleep(100);
>
>
> }
>
>
> ...
>
>
> }
>
>
>
>
> class MyUSBLooper extends BaseIOIOLooper {
>
>
> void setup(){
>
>
>
> ...
>
>
> }
>
>
>
> void loop(){
>
>
> i2c.write(...);
>
>
>
> Thread.sleep(100);
>
>
> }
>
>
> ...
>
>
> }
>
>
> ...
>
> }
>
> If anyone has any experience with this type of IOIO use case, or more
> experience with Thread handling in Java/Android (I am relatively new), I
> could really use some help.
>
> Thanks,
>
> Eric
>
>
>
>
>
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.