tockn/MPU6050_tockn

Accelerometer getting stuckk at value 0.

Opened this issue · 0 comments

mpu6050.update();

if(millis() - timer > 100){
avg_acc = sqrt(pow(mpu6050.getAccX(),2) + pow(mpu6050.getAccY(),2) +pow(mpu6050.getAccZ(), 2));

// Serial.print("avacc");
Serial.println(avg_acc);

timer = millis();

}

This code gives me the acceleration magnitude, and it works fine. But the issue s that sometimes when I raise the sensor above a certain level the magnitude goes down to 0 and gets stuck there. Can anyone help?