get-resistance

vasily/troyka-mq2/get-resistance

No description
get-resistance
@/get-resistance
VALnumber
AVCCnumber
get-resistance
VAL
AVCC
OHM
OHMnumber
To use the node in your project you should have the vasily/troyka-mq2 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto inValue = getValue<input_VAL>(ctx);
    auto vcc = getValue<input_AVCC>(ctx);
    auto voltage = inValue * vcc;
    if (voltage < 0.01) {voltage = 0.01;};
    auto resistance = 5.0 * (vcc - voltage) / voltage;
    emitValue<output_OHM>(ctx, resistance);
}