read-pressure

wayland/mprls-pressure-sensor/read-pressure

Read pressure.
read-pressure
@/read-pressure
Read pressure.
DEV@/mprls-device
An MPRLS device.
UPDpulse
Update. Trigger reading.
read-pressure
DEV
UPD
hPa
PSI
DONE
DONEpulse
Pulse on completion of reading.
PSInumber
Pressure in pounds per square inch.
hPanumber
Pressure in hectopascals.
To use the node in your project you should have the wayland/mprls-pressure-sensor 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_UPD>(ctx))
        return;

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

    float pressure_PSI = sensor->readPressure();

    emitValue<output_hPa>(ctx,pressure_PSI * 68.947572932);
    emitValue<output_PSI>(ctx,pressure_PSI);
    emitValue<output_DONE>(ctx, 1);
}