Once you have downloaded the files (typically HC-SR04.LIB and HC-SR04.IDX ), follow these exact steps:
Let’s put the library to work. You will simulate an Arduino UNO measuring distance and displaying it on an LCD.
The third-party library for the HC-SR04 adds a virtual model that mimics the real sensor’s behavior. It sends a 10µs trigger pulse and returns an echo pulse whose width is proportional to the distance of a virtual object.