NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.7

bulut:
i tried simple new ping sketch but it just reads up to 40cm and not so much accurate , in you sketch the ping pulse is 1 pulse with 10us width i think if we manipulate the code to 2 or 3 pulses with 16us width it will solve my problem,and i think we have to increase the frequency too.how should we change the code?

The 1 pulse / 10uS width is just to trigger the sensor. The sensor detects this and then sends out it's own multiple pulses. In other words, the sensor doesn't just send out one 10uS pulse, we just trigger it. I have not seen a sensor that doesn't automatically send out multiple pulses from a trigger. Are you sure it's not ready doing this? The fact that it reads distances appears that it's working. Do you even know the maximum sensor distance? Maybe it's only 40cm. Also, you may need to change the uS to CM conversion if your sensor puts out different values. The URM37 sensor is a good example of this. For the URM37 you set US_ROUNDTRIP_CM to 50, as that's how it converts and outputs the distance values.

Tim