read-raw

wayland/lis3dh-accelerometer-spi/read-raw

Read X, Y and Z raw values.
read-raw
@/read-raw
Read X, Y and Z raw values.
DEV@/lis3dh-device-spi
A lis3dh-device.
UPDpulse
Update. Trigger a reading.
read-raw
X
Y
Z
DONE
DEV
UPD
DONEpulse
Pulse on read.
Znumber
Raw Z value.
Ynumber
Raw Y value.
Xnumber
Raw X value.
To use the node in your project you should have the wayland/lis3dh-accelerometer-spi 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_LIS3DH` class instance
    auto sensor = getValue<input_DEV>(ctx);
    sensor->read();
    emitValue<output_X>(ctx, sensor->x);
    emitValue<output_Y>(ctx, sensor->y);
    emitValue<output_Z>(ctx, sensor->z);
    emitValue<output_DONE>(ctx, 1);
}