hx711-device

gabbapeople/hx711/hx711-device

The main device node for the HX711 modules.
hx711-device
@/hx711-device
The main device node for the HX711 modules.
DOUTport
The "DOUT" board port the HX711 module is connected to.
SCKport
The "SCK" board port the HX711 module is connected to.
hx711-device
DEV
DOUT
SCK
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

#pragma XOD require "https://github.com/bogde/HX711"

#include <HX711.h>

node {
    meta {
        using Type = HX711*;
    }

    static_assert(isValidDigitalPort(constant_input_DOUT), "must be a valid digital port");
    static_assert(isValidDigitalPort(constant_input_SCK), "must be a valid digital port");

    HX711 scale;

    void evaluate(Context ctx) {
        if (!isSettingUp())
            return;

        // Initialize the device
        scale.begin(constant_input_DOUT, constant_input_SCK);

        emitValue<output_DEV>(ctx, &scale);
    }
}