Datasheet

measures over the set range. The range can be set to 2G, 4G or 8G
Example for line 2:
X: -0.07 Y: 0.09 Z: 0.98 m/s^2
This is the Adafruit_Sensor'ified nice output which is in m/s*s, the SI units for measuring
acceleration. No matter what the range is set to, it will give you the same units, so its nice to
use this instead of mucking with the raw counts
Example for line 3:
Portrait Up Front
This is the output of the orientaiton detection inside the chip. Since inexpensive
accelerometers are often used to detect orientation and tilt, this sensor has it built in. The
orientation can be Portrait or Landscape, then Up/Down or Left/Right and finally tilted forward
or tilted back. Note that if the sensor is tilted less than 30 degrees it cannot determine the
forward/back orientation. If you play with twisting the board around you'll get the hang of it.
Library Reference
The library we have is simple and easy to use
You can create the Adafruit_MMA8451 object with:
There are no pins to set since you must use the I2C bus!
Then initialize the sensor with:
this function returns True if the sensor was found and responded correctly and False if it
was not found. We suggest something like this:
Adafruit_MMA8451 mma = Adafruit_MMA8451();
mma.begin()
if (! mma.begin()) {
Serial.println("Couldnt start")
while (1);
}
Serial.println("MMA8451 found!");
© Adafruit Industries https://learn.adafruit.com/adafruit-mma8451-accelerometer-breakout Page 16 of 20