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 ;
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().