SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
|
Uses the voltage divider formula to calculate (and output) the resistance of R2 in the circuit. More...
#include <sensesp/transforms/voltagedivider.h>
Protected Attributes | |
float | R1_ |
float | Vin_ |
Protected Attributes inherited from sensesp::Configurable | |
String | description_ = "" |
int | sort_order_ = 1000 |
Protected Attributes inherited from sensesp::ValueProducer< P > | |
P | output |
Additional Inherited Members | |
Static Public Member Functions inherited from sensesp::TransformBase | |
static const std::set< TransformBase * > & | get_transforms () |
Static Public Member Functions inherited from sensesp::Startable | |
static void | start_all () |
Public Attributes inherited from sensesp::Configurable | |
const String | config_path_ |
Protected Member Functions inherited from sensesp::Configurable | |
virtual void | load_configuration () |
Uses the voltage divider formula to calculate (and output) the resistance of R2 in the circuit.
Vout = (Vin x R2) / (R1 + R2) is the voltage divider formula. We know:
Knowing Vin, Vout, and R1, we can calculate R2 (which is what this transform does).
The purpose of this transform is to help determine the resistance value of a physical sensor of the "variable resistor" type, such as a temperature sensor, or an oil pressure sensor. If we know the resistance of the sensor, we can then determine the temperature (or pressure, etc.) that the sensor is reading, by connecting this transform's output to an instance of the CurveInterpolator transform.
Definition at line 73 of file voltagedivider.h.
|
overridevirtual |
Returns a configuration schema that specifies the key/value pairs that can be expected when calling get_configuration(), or are expected by set_configuration(). The schema will be in JSON Schema format
Reimplemented from sensesp::Configurable.
Definition at line 68 of file voltagedivider.cpp.
|
overridevirtual |
Returns the current configuration data as a JsonObject. In general, the current state of local member variables are saved to a new object created with JsonDocument::as<JsonObject>() and returned.
Reimplemented from sensesp::Configurable.
Definition at line 55 of file voltagedivider.cpp.
|
overridevirtual |
Sets the current state of local member variables using the data stored in config.
Reimplemented from sensesp::Configurable.
Definition at line 70 of file voltagedivider.cpp.
|
protected |
Definition at line 85 of file voltagedivider.h.
|
protected |
Definition at line 86 of file voltagedivider.h.