Something along the lines of:

public IOIOLooper createIOIOLooper(String connectionType, Object extra) {
  if (extra.equals("COM1")) {
    return new MyFirstLooper();
  } else if (extra.equals("COM2")) {
    return new MySecondLooper();
   }
}

or:

public IOIOLooper createIOIOLooper(String connectionType, Object extra) {
  return new MyGenericLooper(extra);
}

If you want the behavior you've mentioned (i.e. not use the application
framework and the IOIO threads and stuff), look at the IOIOFactory class.
Consider, however, that you'll need to spend some efforts dealing with
waiting for a connection to the IOIO, dealing with disconnection /
reconnection, etc.


On Thu, Feb 6, 2014 at 4:24 AM, Ferris <[email protected]> wrote:

> Hi Ytai,
> Thanks for your response.
> Would you be able to provide a short example? Ideally I would like to be
> able to pass a COM port to connect to and return a ioio_ that I can
> associate with the com port.
>
>
> On Wednesday, February 5, 2014 1:14:00 AM UTC, Ytai wrote:
>
>> Sure. Notice that your createIOIOLooper() method that you implemented
>> takes some arguments. Those arguments will uniquely identify the port to
>> which the IOIO is connected and for which you're creating the looper. You
>> can then instantiate a different Looper class based on those arguments, or
>> pass them as a constructor arguments to your Looper class to achieve a
>> different behavior.
>>
>>
>> On Tue, Feb 4, 2014 at 9:38 AM, Ferris <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have successfully connected multiple IOIO boards to the
>>> HelloIOIOConsole PC application using multiple colon-separated COM ports as
>>> the ioio.SerialPorts property. When a command is run (e.g. to toggle an
>>> LED) - every connected board reacts. Is there a way to
>>> communicate individually with each connected IOIO? For example, reading a
>>> digital pin on a specified IOIO.
>>>
>>> Thanks.
>>>
>>> --
>>> 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/groups/opt_out.
>>>
>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to