Yes!
The wait this works is:

digitalOutPin.write(xxx);  // set the output
ioio_.sync();
float value = analogInPin.readSync();

I'm trying to think of a good way to explain the semantics:
The first write will write to the pin asynchronously, i.e. it will send a
message to the IOIO to set the pin state, which will eventually get
executed sometime in the near future, after the method has already returned.
Then, the sync method send a "ping" to the IOIO and then *blocks* until the
IOIO sends back a ping. So by the time the ping returns, we know for
certain that the pin write has completed. Any message arriving *from* the
IOIO after the ping is also guaranteed to have been generated after the
ping has been sent, thus after the output pin has been set. Finally the
readSync() method, unlike read(), will block shortly until a new sample has
arrived from the IOIO, which is now guaranteed to be fresher than the
setting of the output.

I hope this is semi-clear :)
Let me know if that works OK. It seems to in my tests.



On Sun, Jan 12, 2014 at 8:32 AM, Markus Kaczmarek <
[email protected]> wrote:

> Amazing!
> Does this
>
>    - Added APIs for synchronizing asynchronous I/O operations. For
>    example, it is now possible to write to a DigitalOutput, and then read an
>    AnalogInput that was sampled *after* the output pin changed its state.
>
> mean that one no longer needs to open and close the digital out when
> multiplexing matrices? :):)
>>
>>   --
> 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