Taking the approach of the OP is unfeasible. There is too much jitter
(timing variability) in both the communication between the IOIO and the
Android and the Android thread scheduling to be able to achieve such high
timing accuracy.

The suggestions I gave the OP are still valid.
Another approach would be to generate a steady pulse train of 0.32ms/10ms
using PwmOutput and using a simple analog circuit (diode, resistor,
capacitor) to emit the peaks (maxima) in the sensor's output. This way, the
analog measurements don't need to be perfectly aligned with the pulses.

On Sat, Jul 25, 2015 at 7:30 AM, Lo <[email protected]> wrote:

> Hi Jason, Ytai,
>
> 2 years later...
>
> @Jason, did you find a solution at your problem ?
>
> Cause I'me currently doing exactly the same stuff with ioio and sharp and
> I get exactly what you described...
>
> I'm a bit confusing with the data sheet of sharp sensor.
> I don't know if it meaning  milliseconds...microseconds..
> And how to do it just with a IOIO board without any arduino.
>
> @Ytai, without an arduino, you meant it's impossible to do this with ioio
> cause it's too slow ?
>
> Thanks.
> Lo.
>
>
>
> Le dimanche 17 novembre 2013 00:53:46 UTC+1, Jason Gass a écrit :
>>
>> Hey everyone,
>>
>> I have a question about how to accurately delay the loop method for a
>> specific number of microseconds.
>>
>> The sensor I am trying to configure is the Sharp dust sensor. I have this
>> working on an arduino with the following code.
>>
>> digitalWrite(ledPower,LOW); // power on the LED
>> delayMicroseconds(280);
>> voMeasured = analogRead(measurePin); // read the dust value
>> delayMicroseconds(40);
>> digitalWrite(ledPower,HIGH); // turn the LED off
>> delayMicroseconds(9680);
>>
>> My question is what is the best way to replicate the delayMicroseconds()
>> lines in java for the ioio board.
>>
>> This is what I attempted but didn't receive accurate results.
>> ledPower.write(false);
>> TimeUnit.MICROSECONDS.sleep(280);
>> voMeasured= measurePin.getVoltage();
>> TimeUnit.MICROSECONDS.sleep(40);
>> ledPower.write(true);
>> TimeUnit.MICROSECONDS.sleep(9680);
>>
>> On the arduino I get a consistent output voltage but on the IOIO I get a
>> bunch of 0's followed by some random numbers.
>>
>> Let me know if you need anymore information.
>> 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/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