init

wayland/scd30-co2-rh-temp/init

Initializes SCD30 device.
init
@/init
Initializes SCD30 device.
DEV@/scd30-device
An SCD30 device.
INITpulse
Trigger for initialization. Default is to initialize on boot.
init
OK
ERR
DEV
INIT
ERRpulse
Pulse if initialization failed.
OKpulse
Pulse if initialization successful.
To use the node in your project you should have the wayland/scd30-co2-rh-temp 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) {
    // The node responds only if there is an input pulse
    if (!isInputDirty<input_INIT>(ctx))
        return;

    // Get a pointer to the `SCD30` class instance
    auto airSensor = getValue<input_DEV>(ctx);

    // Attempt to initialize SCD30 module; if attempt fails emit pulse from error port
    if (!airSensor->begin()) {
        emitValue<output_ERR>(ctx, 1);
        return;
    }

    // Pulse that module initialized successfully
    emitValue<output_OK>(ctx, 1);

}