get-weight

gabbapeople/hx711/get-weight

Reads the current weight in "human readable" measure units. The uints depend on the SCALE value. This is the average raw value without the tare weight and divided by the SCALE value obtained via calibration.
get-weight
@/get-weight
Reads the current weight in "human readable" measure units. The uints depend on the SCALE value. This is the average raw value without the tare weight and divided by the SCALE value obtained via calibration.
DEV@/hx711-device
The HX711 device.
Nnumber
How many times to read. 1 by default.
DOpulse
Triggers a new reading.
get-weight
DEV
N
DO
DEV'
W
DONE
DONEpulse
Pulses when the reading is done.
Wnumber
Weight.
DEV'@/hx711-device
The HX711 device.
To use the node in your project you should have the gabbapeople/hx711 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

node {

    float weight = 0;

    void evaluate(Context ctx) {
        auto dev = getValue<input_DEV>(ctx);

        if (isSettingUp())
            emitValue<output_DEVU0027>(ctx, dev);

        if (!isInputDirty<input_DO>(ctx))
            return;

        if (dev->is_ready()) {
            uint8_t n = getValue<input_N>(ctx);
            weight = dev->get_units(n);
        }

        emitValue<output_W>(ctx, weight);
        emitValue<output_DONE>(ctx, 1);

    }
}