Page 1 of 1

How to read the pulse width from GPIO

Posted: Thu Jan 11, 2024 5:11 am
by shatirah_
Hi, I'm new to Espressif-IDE software and currently working with ESP32-S3.
I try to capture the pulse width time by using the example code provided: https://github.com/espressif/esp-idf/bl ... _hc_sr04.c

The signal from the product be sent continuously to 1 GPIO pin.
So from the code, I disable the Trig function and use the Echo function only to read the pulse. I'm not sure if the code is suitable for my case or not, but for the first time, its able to read the exact reading as the oscilloscope. But now the code reading become unstable.

Please advice me the right way to write code to read the pulse width.
Thank you in advance.