Ultrassonic sensor


I have this ultrassonic sensor http://www.micropik.com/PDF/HCSR04.pdf

To measure a distance I must send a HIGH signal to the trigger_pin for 10 usec and then set the trigger to LOW. The datasheet says that during the 10 usec should be sent 8 pulses cause it work at 40khz.

If the frequency is 40kh the period is 0.000025 seconds. 8 pulses should take 200 usec. Why does the datasheet tells me to keep the trigger pin for 10 usec at high when it should be kept at high for 200 usec?

just use this function!

double getDistance(int trigPin, int echoPin){
digitalWrite(trigPin, LOW);
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);
return (pulseIn(echoPin,HIGH)/58.0); //get centimeter

The sensor has its own processor to generate the outgoing pulses and read the echo, so all you need to do is catch its attention long enough to trigger it. 10us is long enough

I expect so, but I don't have the source code for the sensor's processor, so can't say for sure.