mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-11-18 11:15:36 +01:00
32 lines
703 B
ReStructuredText
32 lines
703 B
ReStructuredText
Ultrasonic Sensor
|
|
=================
|
|
|
|
Example Usage
|
|
-------------
|
|
|
|
.. code-block:: cpp
|
|
|
|
// Basic
|
|
App.make_ultrasonic("Ultrasonic", 12, 13); // trigger pin: 12, echo pin: 13
|
|
// Filter out timeouts
|
|
auto ultrasonic = App.make_ultrasonic("Ultrasonic", 12, 13);
|
|
ultrasonic.mqtt->set_filters({
|
|
new sensor::FilterOutNANFilter(), // filter out timeouts
|
|
});
|
|
// Set timeout, 4 meters
|
|
ultrasonic.sensor->set_timeout_m(4.0f);
|
|
|
|
.. cpp:namespace:: nullptr
|
|
|
|
See :cpp:func:`Application::make_ultrasonic_sensor`.
|
|
|
|
API Reference
|
|
-------------
|
|
|
|
.. cpp:namespace:: nullptr
|
|
|
|
.. doxygenclass:: sensor::UltrasonicSensorComponent
|
|
:members:
|
|
:protected-members:
|
|
:undoc-members:
|