PING))) Ultrasonic Sensor

When the distance between the ultrasonic sensor and the wall was measured with the following program, the value displayed on the serial monitor was the observation limit, and even if an obstacle was placed between them, the value did not change. Please give me an answer

const int pingPin = 7;
unsigned long duration,durance ;

void setup()
{
Serial.begin(9600);
}

void loop()
{
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);

durance = duration/58;
Serial.print(durance);
Serial.println("cm");

delay(500);
}

I think problem is in the pulse you generated to trigger pin.
Try changing delayMicroseconds(5) to delayMicroseconds(10)

Also, in configuration should be placed in setup() function. You can refer to this tutorial

Thank you for answering
Changed to delayMicroseconds (10),
but there was no change

IoT_hobbyist:
Also, in configuration should be placed in setup() function. You can refer to this tutorial

The PING))) sensor is different than the one in that tutorial in that it only has a single signal pin, which is used for the ping and the echo. For this reason, it is necessary to set the pin mode of pingPin to OUTPUT before sending the ping, then to INPUT mode to listen for the echo pulse. So although normally it is correct to set pinMode in setup(), in this case it must be done in loop().

Thank you for answering
In this case, pingPin pin mode is set to OUTPUT and INPUT mode to loop (), but it does not work