You can do your write() calls directly within the onTouched() if you want.
If you're using Bluetooth, assume around 20ms of latency as a given
constraint. I don't know where the rest of the latency is coming from, but
it is unlikely related to the IOIO.

On Wed, Sep 24, 2014 at 1:21 PM, Yang Zhang <[email protected]> wrote:

> Hello
>
> I'm using my android device to drive four solenoids which is controlled
> directly by the GPIO of IOIO.
>
> For now there is a 100ms delay between I touch the screen and the
> solenoids be powered.
>
> Is there a way to decrease this delay?
>
> For now, I defined a global variable force_feedback and the ioio loop
> will check this variable for powering the solenoids with a delay of 1
> millisecond.
>
> Define a listener to the View and set the variable force_feedback to be
> true if users touch the screen
>
>   public onTouchListener touchListener = new onTouchListener(){
>
>           public void onTouched(View v, boolean t){
>
>                   if(t){
>
>                          force_feedback = true;
>
>                   }else{
>
>                          force_feedback = false;
>
>                  }
>
>          }
>
>
> Define the ioio loop
>
>                 public void loop() throws ConnectionLostException {
>
>                         led_.write(!force_feedback);
>
>                        solenoid1_.write(!force_feedback);
>
>                        solenoid2_.write(!force_feedback);
>
>                        solenoid3_.write(!force_feedback);
>
>                        solenoid4_.write(!force_feedback);
>
>                         try {
>
>                               Thread.sleep(1);
>
>                        } catch (InterruptedException e) {
>
>                         }
>
>                }
>
>        }
>
>
>  --
> 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.
>

-- 
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.

Reply via email to