MPU6050 gyroscope not working correctly
I am using the bluepill board and was trying to compute the angle from gyroscope raw data. However, when I tilt the sensor, the angle measured doesn't change as expected. It's changing between 1.xx and 2.xx regardless of the tilt angle. The sensor is being read every 4ms (I have configured the timer to interrupt at every 4ms). I have attached my code here, can anyone please help to to figure out what is the problem? Thanks!
Update: I try to remove the offset but the reading is still inaccurate. When the row angle is 45 degrees, it shows around 20 degrees; when the row angle is 30, it shows around 13 degrees. Both the angle calculated seems to be around 2.3 times less than the actual angle.
