No, there isn't, and even if there were, I'm not sure this will actually do what you want. Have you tried the hack I recommended on the previous post?
On Mon, Apr 21, 2014 at 8:36 PM, Vic Wintriss <[email protected]>wrote: > Good idea about the logic fix. I’m redoing the interface boards, so I > might add that logic. > If I am, in fact, reading part of the trigger pulse, is there any way of > imposing a short, predictable delay…say 50 microsecs…after the trigger > pulse but before the getDuration() read? > > On Apr 21, 2014, at 5:12 PM, Ytai Ben-Tsvi <[email protected]> wrote: > > Good catch, I forgot about this constraint. > In that case, this (similar to what you've proposed) approach might work: > > beginBatch(); > generatePulse(); > openPulseIn(); > endBatch(); > getDuration(); > closePulseIn(); > > I'd like to emphasize that the fact we have to jump through weird hoops to > get is working is mostly due to the fact that this sensor has a weird > interface. BTW, another thing you can do is use a discrete logic gate to > filter out the ping input pulse from the output. Something like: > clean_out = ping_pin & !ioio_pulse_out_pin > > This will convert the Ping's interface to be similar to the one of the > other sensor I referred you to. > > > > On Mon, Apr 21, 2014 at 3:23 PM, Vic Wintriss <[email protected]>wrote: > >> I don't think that I can use getDurationBuffered() in this case. The >> getDuration() Interface notes say: "...Note that once a pulse is detected, >> the next one must have its leading edge at least 5ms after the leading edge >> of the current one, or else it will be skipped." The ping pulse is about >> 50 microsecs long, and the echo pulse comes about 750 microsecs after the >> ping pulse, If I am getting the last part of the ping pulse, the echo >> pulse will come too soon for getDurationBuffered() to acquire the echo >> pulse. Am I understanding this right? >> >> >> On Sunday, April 13, 2014 7:22:39 PM UTC-7, Vic Wintriss wrote: >>> >>> I am trying to use the Parallax Ping))) ultrasonic sensor with a ioio V1 >>> board, using the IOIO00503 library. I get a good looking signal...see the >>> attached scope view, but the input.getDuration() call returns 16.8 micro >>> seconds most of the time, called 2 times per second. Every once in a while >>> I get the proper number. >>> >>> Any ideas? Here is the code: >>> >>> import ioio.lib.api.DigitalOutput; >>> >>> import ioio.lib.api.IOIO; >>> >>> import ioio.lib.api.PulseInput; >>> >>> import ioio.lib.api.PulseInput.PulseMode; >>> >>> import ioio.lib.api.exception.ConnectionLostException; >>> >>> >>> public class UltraSonicSensors >>> >>> { >>> >>> private static final int LEFT_ULTRASONIC_INPUT_PIN = 35; >>> >>> private static final int LEFT_STROBE_ULTRASONIC_OUTPUT_PIN = 15; >>> >>> private final PulseInput leftInput; >>> >>> private DigitalOutput leftStrobe; >>> >>> private float leftDistance; >>> >>> private IOIO ioio; >>> >>> >>> public UltraSonicSensors(IOIO ioio) throws ConnectionLostException >>> >>> { >>> >>> this.leftInput = ioio.openPulseInput(LEFT_ULTRASONIC_INPUT_PIN, >>> PulseMode.POSITIVE); >>> >>> this.leftStrobe = ioio.openDigitalOutput(LEFT_ >>> STROBE_ULTRASONIC_OUTPUT_PIN); >>> >>> this.ioio = ioio; >>> >>> } >>> >>> >>> public void read() throws ConnectionLostException, InterruptedException >>> >>> { >>> >>> read(leftStrobe, leftInput); >>> >>> } >>> >>> >>> private void read(DigitalOutput strobe, PulseInput input) >>> throwsConnectionLostException, InterruptedException >>> >>> { >>> >>> ioio.beginBatch(); >>> >>> strobe.write(true); >>> >>> strobe.write(false); >>> >>> ioio.endBatch(); >>> >>> this.leftDistance = input.getDuration(); >>> >>> } >>> >>> >>> public float getLeftDistance() >>> >>> { >>> >>> return leftDistance; >>> >>> } >>> >>> } >>> >> >> -- >> 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 a topic in the > Google Groups "ioio-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ioio-users/3MDLEEKtejY/unsubscribe. > To unsubscribe from this group and all its topics, 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. > -- 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.
