Hello,
>

Thank you for your response. 

1.) So it is okay to assume if the wave is consistent that the value 
produced by Positive mode would be 50% more than the value of 
getFrequency()?

I have added another thread, but my second channel doesn't appear to be 
reading and my first channel continues to produce numbers well after the 
cable is unhooked. I created two IOIOThread classes.

class IOIOThread extends AbstractIOIOActivity.IOIOThread {
 private PulseInput pulse1;
@Override
public void setup() throws ConnectionLostException {
try {
 pulse1 = ioio_.openPulseInput(new DigitalInput.Spec(1), 
ClockRate.RATE_62KHz,  PulseMode.POSITIVE, false);
 } catch (ConnectionLostException e) {
throw e;
}
}

@Override
public void loop() throws ConnectionLostException, InterruptedException {
 float freqHz1 =0;
  
TimerTask t = new TimerTask() {
  public void run() {
     interrupt();
  }
};
Timer timer = new Timer();
timer.schedule(t, 1000); 
 try {
freqHz1 = 1.0f / pulse1.waitPulseGetDuration();
 t.cancel();
} 
catch (InterruptedException ex) {
freqHz1 = 0;
 } 
  setText1(freqHz1);
sleep(1000);
 }
 }
 class IOIOThread1 extends AbstractIOIOActivity.IOIOThread {
 private PulseInput pulse2;

@Override
public void setup() throws ConnectionLostException {
try {
 pulse2 = ioio_.openPulseInput(new DigitalInput.Spec(2), 
ClockRate.RATE_62KHz,  PulseMode.POSITIVE, false);
 } catch (ConnectionLostException e) {
throw e;
}
}

@Override
public void loop() throws ConnectionLostException {
  float freqHz2=0;
  
TimerTask t = new TimerTask() {
  public void run() {
     interrupt();
  }
};
Timer timer = new Timer();
timer.schedule(t, 1000); 
  try {
 freqHz2 = 1.0f / pulse2.waitPulseGetDuration();
 t.cancel();
} catch (InterruptedException ex) {
 freqHz2 = 0;
 } 
 setText2(freqHz2);
try {
sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 }
  }

@Override
protected AbstractIOIOActivity.IOIOThread createIOIOThread() {
return new IOIOThread();
} 

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