Hi,
I'm connecting MMA8452Q like this:
Arduino --------------- MMA8452Q Breakout
3.3V --------------- 3.3V
GND --------------- GND
SDA (A4) --/330 Ohm/-- SDA
SCL (A5) --/330 Ohm/-- SCL
as mentioned here:
https://learn.sparkfun.com/tutorials/mma8452q-accelerometer-breakout-hookup-guide/all
and using also their code:
#include <Wire.h> // Must include Wire library for I2C
#include "SparkFun_MMA8452Q.h" // Click here to get the library: http://librarymanager/All#SparkFun_MMA8452Q
MMA8452Q accel; // create instance of the MMA8452 class
void setup() {
Serial.begin(9600);
Serial.println("MMA8452Q Basic Reading Code!");
Wire.begin();
accel.init();
if (accel.begin() == false) {
Serial.println("Not Connected. Please check connections and read the hookup guide.");
while (1);
}
}
void loop() {
if (accel.available()) {
accel.read();
Serial.print("Acceleration on the x-axis is ");
Serial.println(accel.cx);
Serial.print("Acceleration on the y-axis is ");
Serial.println(accel.cy);
Serial.print("Acceleration on the z-axis is ");
Serial.println(accel.cz);
}
delay(200);
}
It starts ok with logical readings and after a while of moving the accelarator a little bit, just stop or stuck on the same value.
Any idea?
Thanks.