Loom_MMA8451 class

MMA8451 accelerometer sensor module.

Base classes

class LoomI2CSensor
Abstract root for I2C sensor modules.

Protected variables

Adafruit_MMA8451 MMA
Underlying MMA8451 sensor manager instance.
float accel
Acceleration values for each axis. Units: g.
uint8_t orientation
Orientation.
mma8451_range_t range
Range setting (2/4/8 G)

CONSTRUCTORS / DESTRUCTOR

Loom_MMA8451(LoomManager* manager, const byte i2c_address = 0x1D, const uint8_t mux_port = 255, const mma8451_range_t range = MMA8451_RANGE_2_G)
Constructor.
Loom_MMA8451(LoomManager* manager, JsonArrayConst p)
Constructor that takes Json Array, extracts args and delegates to regular constructor.
~Loom_MMA8451() defaulted virtual
Destructor.

OPERATION

void measure() override
Take any relevant measurements.
void package(JsonObject json) override
Package a modules measurements or state.

Function documentation

Loom_MMA8451::Loom_MMA8451(LoomManager* manager, const byte i2c_address = 0x1D, const uint8_t mux_port = 255, const mma8451_range_t range = MMA8451_RANGE_2_G)

Constructor.

Parameters
manager
i2c_address in Set(Int) | <0x1D> | {0x1C, 0x1D} | I2C address
mux_port in Int | <255> | [0-16] | Port on multiplexer
range in Set() | <"MMA8451"> | null | MMA8451 module name

Loom_MMA8451::Loom_MMA8451(LoomManager* manager, JsonArrayConst p)

Constructor that takes Json Array, extracts args and delegates to regular constructor.

Parameters
manager
in The array of constuctor args to expand

void Loom_MMA8451::package(JsonObject json) override

Package a modules measurements or state.

Parameters
json out Object to put data into

void Loom_MMA8451::print_measurements() const override

Print the last set of measurements taken.

Does not package the data.