I bought an IMU (the MPU-6050) and i find how to read the raw value of my sensor. I want to take this raw value and transform it in degree per second. The problem is that i don't know how to transform the raw values in 0 to 1023 value, and I'm not sure what I have to do after.
Maybe, if you can help me also with the accelerometer, that will be great
The 16-bit ADC for each axis gives you a number from -32768 to +32767. You select a sensitivity (±250, ±500, ±1000, or ±2000) and you map one range to the other:
int DegreesPerSecond = map(rawValue, -32768, +32767, -250, +250);
or
int DegreesPerSecond = map(rawValue, -32768, +32767, -500, +500);
or
int DegreesPerSecond = map(rawValue, -32768, +32767, -1000, +1000);
or
int DegreesPerSecond = map(rawValue, -32768, +32767, -2000, +2000);
There is usually a zero offset to worry about: when the gyroscope isn't being turned it still returns a non-zero value. Subtract that from rawValue before mapping.