Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-06-22 Thread vic . wintriss
Is ioio.sync() in the latest versions? On Wednesday, June 22, 2016 at 9:36:41 PM UTC-7, Ytai wrote: > > You can check the release notes page on the wiki. I strongly recommend > against using old versions of the library. > > On Wed, Jun 22, 2016 at 9:58 AM, >

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-06-22 Thread Ytai Ben-Tsvi
You can check the release notes page on the wiki. I strongly recommend against using old versions of the library. On Wed, Jun 22, 2016 at 9:58 AM, wrote: > It's iARoC time again, and we are having ultrasonic problems again! This > year I am using only 4-pin

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-12 Thread Vic Wintriss
OK…thanks…I’ll try it. > On Apr 12, 2016, at 3:09 PM, Ytai Ben-Tsvi wrote: > > Because there's no guarantee hour long it would take between when your > command executed on the Android and when the actual pin voltage changes. What > you're seeing when having a short (or no)

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-12 Thread Ytai Ben-Tsvi
Because there's no guarantee hour long it would take between when your command executed on the Android and when the actual pin voltage changes. What you're seeing when having a short (or no) delay between the commands is that sometimes they would end up actually getting executed a very short gap

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-12 Thread Vic Wintriss
I'll try it. This will cause some interference with the other robots close by, but may not be a problem. On Tuesday, April 12, 2016 at 10:54:34 AM UTC-7, Ytai wrote: > > No threads involved and nothing asynchronous. You set the PWM once during > setup(), then you getDuration() whenever you

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-12 Thread Ytai Ben-Tsvi
No threads involved and nothing asynchronous. You set the PWM once during setup(), then you getDuration() whenever you please. On Apr 12, 2016 10:52 AM, "Vic Wintriss" wrote: > I would rather run the ultrasonics asynchronously. Also since the kids > may not be be that

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-12 Thread Vic Wintriss
I would rather run the ultrasonics asynchronously. Also since the kids may not be be that advanced in our curriculum I prefer to stay away from threads. The last code that I posted works fine. On Tuesday, April 12, 2016 at 10:37:52 AM UTC-7, Ytai wrote: > > Use PWM output to generate

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-12 Thread Ytai Ben-Tsvi
Use PWM output to generate periodic, precisely timed trigger pulses. On Apr 12, 2016 10:36, "Vic Wintriss" wrote: > I thought I was following your instructions. I am using the 4-pin sensor > as suggested and code that I thought was standard. What did you tell me to > do

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-12 Thread Vic Wintriss
I thought I was following your instructions. I am using the 4-pin sensor as suggested and code that I thought was standard. What did you tell me to do that I am not doing? On Monday, April 11, 2016 at 1:28:48 PM UTC-7, Ytai wrote: > > I feel like I gave you my best advice, but you seem to

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-11 Thread Ytai Ben-Tsvi
I feel like I gave you my best advice, but you seem to insist on doing it in a way that's not supposed to work. On Apr 11, 2016 1:03 PM, "Vic Wintriss" wrote: > When I use this code: > > ioio.beginBatch(); > rightStrobe.write(true); > rightStrobe.write(false); >

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-11 Thread Vic Wintriss
When I use this code: ioio.beginBatch(); rightStrobe.write(true); rightStrobe.write(false); ioio.endBatch(); I get this beautiful result: But the code hangs up and I get no

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-04 Thread vic . wintriss
The output pulse (echo pulse returning from the ultrasonic sensor) is correct...it is milli secs long and varies proportionately with the distance. I am not using Bluetooth...the Android is directly connected to the ioio board. It is the trigger pulse that must be long...more than 10

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-01 Thread Ytai Ben-Tsvi
When you look at the waveforms, what do you see as the output pulse? My guess would be that it is very narrow, in the order of a couple of usec perhaps, and if that's indeed the case, it is likely because both messages comprising the pulse got collapsed into the same packet over one of the slower

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2016-04-01 Thread vic . wintriss
It's a new iARoC (International Autonomous Robot Competition) year (2016) and we are back to the ultrasonic sensor problem. This year I am using the 4-pin version. The following code works: public void readRight() throws ConnectionLostException, InterruptedException {//This code works with

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2015-04-23 Thread Ytai Ben-Tsvi
You can add a TimerTask to interrupt the thread after some timeout. Search the forum for examples if you need them. If you don't want to delay all the other 5 if one is stuck you can easily run 6 sensors on 6 different threads. On Wed, Apr 22, 2015 at 2:42 PM, Daniel Brown mr.g...@gmail.com

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2015-04-22 Thread Daniel Brown
if one PulseInput pin is open or has not received a pulse and you call getDuration() it will block you from reading all other PulseInput pins until it has received at least one pulse. We have found that one bad sensor will stop you from reading any other sensor. On Friday, April 10, 2015 at

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2015-04-10 Thread Daniel Brown
We have a project that uses 6 distance finders, when we try to call .getDuration() on more then one all further reading freezes. protected void setup() throws ConnectionLostException { // front left pulse and echo echoPinfl_ = ioio_.openPulseInput(6, PulseMode.POSITIVE); triggerPinfl_ =

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2015-04-10 Thread Ytai Ben-Tsvi
Vic posted some code earlier on this thread that is claimed to work and looks pretty nice. Why are you not using that? On Fri, Apr 10, 2015 at 3:36 PM, Daniel Brown mr.g...@gmail.com wrote: We have a project that uses 6 distance finders, when we try to call .getDuration() on more then one all

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-05-16 Thread Ytai Ben-Tsvi
Thanks for sharing! On Thu, May 15, 2014 at 9:25 PM, v...@wintrisstech.org wrote: Here is some code that works great with the Parallax Ping))) with the circuit in the file attached (thanks to Ytai): private int read(DigitalOutput strobe, PulseInput input, int inputPin) throws

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-29 Thread Duane DeSieno
I encountered a small problem. In the case of a hardware or wiring problem with the PING, this code that works will hang at the getDuration call. Also, I noticed that a 20ms sleep works and a 10ms sleep does not with working hardware. So my question is, can you give us a way to limit the

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-29 Thread Ytai Ben-Tsvi
Earlier on this thread I answered this question. Essentially you can have a second thread interrupt the blocked thread to unblock it. A TimerTask is a convenient way to achieve this. You can wrap the whole process in a method that would look pretty much like the interface you purposed. On Apr 29,

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-27 Thread Duane DeSieno
My confusion is maybe over the way getDuration works. Does it delay 5ms before looking for the pulse or does it look immediately? I put 555 timer on the input pin and set it up for 3.15hz and 25.4% duty cycle or an 80.6ms pulse every 317.4ms. I called getDuration roughly every 100ms. It did

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-27 Thread Vic Wintriss
I finally got it to work using your last suggestion. This code works that you recommended works perfectly. Thanks so much for sticking with us. We've got 30 or 40 kids using this code at the International Autonomous Robot Competition (iARoC 2014) coming up at the end of June. Check out

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-26 Thread Ytai Ben-Tsvi
@Duane At this point I'm convinced that there is no reason why this *should* work. If it used to work in the past it is probably coincidental and you can of course downgrade if you prefer. I'm not going to spend any time supporting one specific sensor that has a weird interface. You have several

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-26 Thread Vic Wintriss
Can I close the input while I am doing the strobe so that the input is not being exposed to both pulses? On Saturday, April 26, 2014 4:23:51 PM UTC-7, Ytai wrote: @Duane At this point I'm convinced that there is no reason why this *should* work. If it used to work in the past it is

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-26 Thread Vic Wintriss
It doesn't work when I close and then reopen the input line. Can you recommend some tests that I can do to try and find out why it doesn't work? On Saturday, April 26, 2014 4:57:52 PM UTC-7, Ytai wrote: Yes. This is what we tried before. I'm still under the impression that it should have

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-26 Thread Vic Wintriss
Thanks so much for the analaysis...I'll try it tomorrow and let you know...sounds like it might work! On Saturday, April 26, 2014 8:06:53 PM UTC-7, Ytai wrote: OK. I think I know why it isn't working. The way the input capture (PulseInput) works in the firmware is that a 200Hz (=5ms) timer

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-25 Thread Vic Wintriss
I am just trying to put out a pulse on one pin and then read a pulse width on a different pin 750 microsecs later. Why do you say that it was not designed for such a use? On Wednesday, April 23, 2014 9:21:54 PM UTC-7, Ytai wrote: Nope. The PulseInput module was really not designed for such a

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-23 Thread Ytai Ben-Tsvi
Are you using the latest firmware? Also, cancellation is supported. Search the forum for TimerTask. On Tue, Apr 22, 2014 at 10:10 PM, Vic Wintriss vic.wintr...@gmail.comwrote: I tried the following: public void read() throws ConnectionLostException, InterruptedException {

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-23 Thread Vic Wintriss
I'm using 0503. The problem is that the ping and the return are getting out of sync. The getDuration() readings match exactly the times that I see on the scope. How can I synchronize so that I only start listening after the ping pulse is complete? On Wednesday, April 23, 2014 8:51:26 AM

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-23 Thread Vic Wintriss
I have tried all combinations of opening pulse input after sending the trigger pulse...no luck. I am reading both the output (trigger pulse) and the echo (return) pulse...alternately. About 5 trigger pulse readings to each echo pulse reading. Any work around ideas? On Wednesday, April 23,

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-22 Thread Vic Wintriss
I tried the following: public void read() throws ConnectionLostException, InterruptedException { ioio.beginBatch(); leftStrobe.write(false); leftStrobe.write(true); leftStrobe.write(false); leftInput = ioio.openPulseInput(LEFT_ULTRASONIC_INPUT_PIN, PulseMode.POSITIVE);

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-21 Thread Vic Wintriss
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

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-21 Thread Ytai Ben-Tsvi
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

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-21 Thread Vic Wintriss
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,

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-18 Thread Vic Wintriss
OK...understood...I'll try it again. On Apr 18, 2014, at 7:56 AM, Ytai Ben-Tsvi yta...@gmail.com wrote: Your explanation of what's happening is correct. Your solution may work if you get rid of the ioio.waitForConnect() and move the endBatch to where it used to be. However, I don't

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-17 Thread Vic Wintriss
My theory was that the getDuration() call was coming too quickly and actually reading the end of the trigger pulse. I thought that by delaying the getDuration() a bit (or not opening it until the trigger pulse was finished) I could avoid that. Does that hypothesis sound likely to you? Setting

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-16 Thread Vic Wintriss
It’s not too important that we get every pulse. I tried the following code, but still get all zeroes: public class UltraSonicSensors { private static final int LEFT_ULTRASONIC_INPUT_PIN = 35; private static final int LEFT_STROBE_ULTRASONIC_OUTPUT_PIN = 15; private final

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-16 Thread Ytai Ben-Tsvi
Your local leftDistance variable is shadowing the class field... On Apr 16, 2014 3:18 PM, Vic Wintriss vic.wintr...@gmail.com wrote: It’s not too important that we get every pulse. I tried the following code, but still get all zeroes: public class UltraSonicSensors { private static final int

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-15 Thread Vic Wintriss
Thanks for the ideas. I've tried many combinations of synch, readBuffered...etc, but unfortunately it still reads very small numbers...probably measuring the last part of the trigger pulse. Is there any way that I can delay the read by a couple of hundred micro seconds? Could you do the.

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-15 Thread Vic Wintriss
Ytai: This code produces only 1.6875E-5...reading 2 times per second. 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 {

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-15 Thread Ytai Ben-Tsvi
Yes, that's what I meant when I said that you may miss the actual pulse. What about the following approach: beginBatch(); sendPulse(); endBatch(); while (true) { float duration = pulseIn.GetDurationBuffered(); if (duration MIN_DURATION) return duration; } Of course, you can timeout if you

Re: Parallax Ping))) untrasonic sensor porblems with ioio V1 board

2014-04-14 Thread Ytai Ben-Tsvi
getDuration() would return you whatever last pulse width was measured last. What you want is to add a ioio_.sync() followed by input.getDurationSync(), which will guarantee that the pulse has been obtained after the strobe. However, looking at this now, there's a small chance that you'll miss the