hcsr04_sensor

An ESP-IDF component for Physical Computing

Purpose

Distance measurement with an HCSR04 sensor for ESP32 systems.

How it is done

Distance measurement is implemented as a simple C++ class Hcsr04Sensor.

It has one public method GetDistance, which returns the measured distance as a float.

Where to find it

hcsr04_sensor is published on the ESP Registry at https://components.espressif.com/components/elrebo-de/hcsr04_sensor.

The source code can be found at https://github.com/elrebo-de/hcsr04_sensor.

How to use it

As an ESP-IDF component hcsr04_sensor must be included into idf_component.yml as a dependency. As usual this can be done by executing this command:

idf.py add-dependency "elrebo-de/hcsr04_sensor^1.0.6"

In CMakeLists.txt "elrebo-de__hcsr04_sensor" has to be added as a requirement.

Now you can include hcsr04_sensor.hpp and use the Hcsr04Sensor class in your program.


Comments

One response to “hcsr04_sensor”

  1. […] elrebo-de/hcsr04_sensor – to measure distances with an HCSR04 sensor […]

Leave a Reply

Your email address will not be published. Required fields are marked *