MMA845X

MMA845X

This page is to Setup and Config MMA845X

Hardware and Software

Hardware

MMA845X, Arduino or Digispark / ESP8266

Software

Arduino IDE

Sanki Notes

    • I2C :

    • SDA : A4 (Digispark D0)

    • SCL : A5 (Digispark D2)

    • SDO : GND

    • CS : V++

    • Example :https://github.com/stickbreaker/ArduinoAccelerometerDriver

Examples

This example is ..........

            1. #include <Wire.h>

            2. #include "Accelerometer.h"

            3. #include "AccelerometerMMA8451.h"

            4. AccelerometerMMA8451 acc(0);

            5. void setup() {

            6. Serial.begin(9600);

            7. acc.standby();

            8. acc.setDynamicRange(AccelerometerMMA8451::DR_4G);

            9. acc.activate();

            10. }

            11. void loop() {

            12. Serial.print("x: ");

            13. Serial.println(acc.readXg());

            14. Serial.print("y: ");

            15. Serial.println(acc.readYg());

            16. Serial.print("z: ");

            17. Serial.println(acc.readZg());

            18. Serial.println("-----------");

            19. delay(1000);

            20. }