need help in IMU

I download libraries of IMU (MPU6050) and make testing put when i use processing the imu move in graph without i moving it , Can anyone help me ,why it make this?!
another problem in port when i using the port at first time >it works , but in another time when i upload another program on arduino, it tell me that the port is busy , Although i closed all programs and the port not busy?!

IMUs need to be calibrated.

The gyro will report rotation even if it is not rotating, so you need to average the data while it is held still and calculate an offset that is later subtracted from the readings.

The accelerometer will always report acceleration due to the Earth's gravity along the axis that is pointing up and down, however the value reported may not be the same on all axes. To correct that, you need to calculate an offset and gain for each axis. See this article.

Thank you very much, but i used that code in IMU(GY-87), and it hasn't deflections and it is the same as the processing graph, you know why the code worked with Gy-87 and didn't work with MPU6050?


Thanks for helping.