I have a problem with the Ultrasonic sensor.
The script gives me directly the distance based on the speed of sound in the air. But I want to try it in water. So the speed is not the same! How to do to just have the time of the echo on not the distance calculated directely.
In the sensor HC-SR04 we have two outputs TRIG and ECHO and it was easy to have the time of echo but on GROVE I don’t know how to do
Thanks a sorry for my poor english
You can get the duration(unit is uS) from below code.
If it transmits @ air, the distance is 58 * duration.
You can base on ultrasonic speed difference between water and air to get the number for water, which is 58 for air.
Then you can get the distance for water. thanks.
<LINK_TEXT text=“https://github.com/Seeed-Studio/Grove_U … ic.cpp#L79”>https://github.com/Seeed-Studio/Grove_Ultrasonic_Ranger/blob/master/Ultrasonic.cpp#L79</LINK_TEXT>