Datasheet
Set & Get Range
You can set the accelerometer max range to ±2g, ±4g or ±8g with
And read what the current range is with
Which returns 1 for ±2g, 2 for ±4g and 3 for ±8g
Read Raw Count Data
You can read the raw counts data with
The x, y and z data is then available in mma.x, mma.y and mma.z
All three are read in one transaction.
Reading Normalized Adafruit_Sensor data
We recommend using the Adafruit_Sensor interface which allows reading into an event
structure. First create a new event structure
Then read the event whenever you want
The normalized SI unit data is available in event.acceleration.x, event.acceleration.y
and event.acceleration.z
Read Orientation
mma.setRange(MMA8451_RANGE_2_G);
mma.setRange(MMA8451_RANGE_4_G);
mma.setRange(MMA8451_RANGE_8_G);
mma.getRange()
mma.read();
sensors_event_t event;
mma.getEvent(&event);
© Adafruit Industries https://learn.adafruit.com/adafruit-mma8451-accelerometer-breakout Page 17 of 20