read-magnetic-field-strength

wayland/bno055-aos/read-magnetic-field-strength

Reads magnetic field strength in each of the three axes.
read-magnetic-field-strength
@/read-magnetic-field-strength
Reads magnetic field strength in each of the three axes.
DEV@/bno055-device
A bno055 device.
UPDpulse
Update. Triggers new read.
read-magnetic-field-strength
X
Y
Z
DONE
DEV
UPD
DONEpulse
Pulses on completion of read.
Znumber
Magnetic field strength in Z-axis (micro Tesla).
Ynumber
Magnetic field strength in Y-axis (micro Tesla).
Xnumber
Magnetic field strength in X-axis (micro Tesla).
To use the node in your project you should have the wayland/bno055-aos 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_BNO055` class instance
    auto aos = getValue<input_DEV>(ctx);

    imu::Vector<3> magnetometer = aos->getVector(Adafruit_BNO055::VECTOR_MAGNETOMETER);
    emitValue<output_X>(ctx,magnetometer.x());
    emitValue<output_Y>(ctx,magnetometer.y());
    emitValue<output_Z>(ctx,magnetometer.z());
    emitValue<output_DONE>(ctx, 1);
}