Hi,
I am working on ultrasonic sensor to sense distance. I am looking for code that does not use much delay to sense distance. Please help me. Thanks.
Joe
Hi,
I am working on ultrasonic sensor to sense distance. I am looking for code that does not use much delay to sense distance. Please help me. Thanks.
Joe
You have to leave a reasonable amount of time for the pulse to travel out and back, allowing for a speed of 343 metres per second each way or it will take 1 second to reflect off an object 171 metres away.
As far as I am aware, pulses are not coded so reducing the interval might cause the device to return distance from a reflection transmitted by an earlier pulse but measured from the last one.
Rgds,
Neil.
Do you have working code already? How long does it take?
Download the NewPing library.
The example code works perfectly.
arduinoaleman:
Download the NewPing library.The example code works perfectly.
Perhaps you meant NewPing library