How can I change the timeout of the Ping Sensor?
ArtLa
Posts: 3
I am using 7 ea. Ping sensors with a short range to the target, about 6 to 10 inches. I am activating each sensor and waiting for a response from the sensor until I trigger the next one to avoid crosstalk. I am using C. The update rate from the array is great when every sensor detects a target, however, when a target is missed and one or more sensors time out, the update rage drops because of the approximately 20ms timeout for each sensor. Is it possible to change the Ping timeout? I'd like a timeout of arpound 2 ms, which is further than any of my targets, and I can then use that timeout to detect a missing targe and still get a fast update from the other sensors.It would be great to do this in C, by changing some parameter, for example in the simpletools.hor soime other file.
Comments
BTW, welcome to the Parallax Forum, ArtLa!
-Phil
Note that the timeout equates to the maximum distance, therefore changing that means reducing the effective range.
Edit: Great Minds, Phil. :nerd:
You don't have to use the Ping library function to use the Ping))) in C. Take a look at the C source code to glean what you need to know to write your own Ping function.
-Phil
set_io_timeout(CLKFREQ/350);
After that change, the timeout is about 2.2msec, and with a missing target the ping function returns a time of slightly over 2220usec. This is perfect for my needs and now the response of the sensor array is high and missing targets does not slow down the response due to the 20msec default timeout.
Thanks for the suggestion to look at the ping C code.
Art