Obakemono:
...As far as i have understanded from the datasheet ¿it auto calibrates to 0g right?, i mean, i don't need to substract any 0g value from my output ¿right?.And at +-2g scale the sensitivity is 16384 LSB/g so, to get acceleration in g's, at 16bits, (rawAxis - 32767)/16384 ¿am i right?
My sketch is ment to give a quick start. On this page Arduino Playground - HomePage I mention to use the library by Jeff Rowberg for serious use.
The MEMS sensors are a great invention, but they have a large offset and the sensitivity is inaccurate.
Lucky for us, the sensitivity of the MPU-6050 is calibrated. The gyro sensitivity scale and the accelerometer scale are factory calibrated.
But not the offset (I can't read it in the datasheet).
So when using the raw values, the offset could be taken care of in software. Or by using the undocumented offset registers in the MPU-6050.
When using DMP firmware, the offset compensation could be in the firmware.
Accelerator with +/-2g range = 16384 LSB/g. So a value of 16384 is 1 g.
Get the accelerator value during setup(), and save it in rawOffset.
In the loop() get the value and calculate the 'g' value:
double g;
g = (double) (rawAxis - rawOffset ) / 16384.0;
And that for all 6 values (3 gyro, 3 accel).
During setup() the z-axis gets 1 'g' of the earth gravity. So you have to add 1 'g' after the offset compensation.