2018-05-13 11:37:02 +02:00
|
|
|
ESP32 Pulse Counter Sensor
|
|
|
|
==========================
|
|
|
|
|
|
|
|
This component allows you to count pulses on a PIN using the internal
|
|
|
|
`pulse counter <http://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/pcnt.html>`_ peripheral of
|
|
|
|
the ESP32. By default, the values by this sensor are reported in "pulses/min". You can convert
|
|
|
|
that to your own unit like in below example.
|
|
|
|
|
|
|
|
Example Usage
|
|
|
|
-------------
|
|
|
|
|
|
|
|
.. code-block:: cpp
|
|
|
|
|
|
|
|
// Basic
|
2018-10-20 15:10:26 +02:00
|
|
|
App.make_pulse_counter_sensor("Pulse Counter", 13);
|
2018-05-13 11:37:02 +02:00
|
|
|
// Unit conversion
|
2018-10-20 15:10:26 +02:00
|
|
|
auto pcnt_1 = App.make_pulse_counter_sensor("Pulse Counter 2", 13);
|
|
|
|
pcnt_1.pcnt->set_unit_of_measurement("kW");
|
|
|
|
pcnt_1.pcnt->clear_filters();
|
|
|
|
pcnt_1.pcnt->add_multiply_filter(0.06f); // convert from Wh pulse to kW
|
2018-05-13 11:37:02 +02:00
|
|
|
|
2018-05-14 21:15:49 +02:00
|
|
|
.. cpp:namespace:: nullptr
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
See :cpp:func:`Application::make_pulse_counter_sensor`.
|
|
|
|
|
|
|
|
API Reference
|
|
|
|
-------------
|
|
|
|
|
|
|
|
.. cpp:namespace:: nullptr
|
|
|
|
|
|
|
|
.. doxygenclass:: sensor::PulseCounterSensorComponent
|
|
|
|
:members:
|
|
|
|
:protected-members:
|
|
|
|
:undoc-members:
|