Using MPU6050 Adafruit library, I tried to set accelerometer range to +-4g, and gyroscope range to +-500 deg/s. However, when I start printing the data, I still get accelerations going well and over +4g or -4g. Even going up to 16g. Is there something wrong with my code? Or did I not get the concept properly, help would be appreciated thank you so much.
The void setup
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
Serial.begin(115200);
mpu.begin();
mpu.setAccelerometerRange(MPU6050_RANGE_4_G);
mpu.setGyroRange(MPU6050_RANGE_1000_DEG);
mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
}
To print the data
void printData(int i) {
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
Serial.print(i);
Serial.print(',');
Serial.print(a.acceleration.x, 5);
Serial.print(',');
Serial.print(a.acceleration.y, 5);
Serial.print(',');
Serial.print(a.acceleration.z, 5);
Serial.print(',');
Serial.print(g.gyro.x, 5);
Serial.print(',');
Serial.print(g.gyro.y, 5);
Serial.print(',');
Serial.println(g.gyro.z, 5);
}
Here is what the data looks like on my serial monitor, with the first column printing the line count.