The ultrasonic sensor uses sonar to determine the distance to an object. the ESP32 and provide several example sketches to determine the distance to an object using the HC-SR04.
the ESP32 code is placed on my blog :
https://www-winson.blogspot.com/2023/...
#hcsr04 #esp32project #esp32 #arduinoIDE2 #arduino