Guide to gyro and accelerometer with Arduino including Kalman filtering

Thanx Lauszus,

I have another questions thought.
If I only change Analogue reading code in your code and replace it with I2C based digital reading to suite my IMU, that onwards I can use your code as-is, right?

Please have a look below, it's from the link:
http://mbed.org/users/aberk/programs/IMUfilter_RPYExample/lijojl/docs/main_8cpp_source.html

00022 #define GYROSCOPE_GAIN (1 / 14.375)
00023 //Full scale resolution on the ADXL345 is 4mg/LSB.
00024 #define ACCELEROMETER_GAIN (0.004 * g0)
00025 //Sampling gyroscope at 200Hz.
00026 #define GYRO_RATE 0.005
00027 //Sampling accelerometer at 200Hz.
00028 #define ACC_RATE 0.005
00029 //Updating filter at 40Hz.
00030 #define FILTER_RATE 0.1

I have not seen such things like GYROSCOPE_GAIN, ACCELEROMETER_GAIN, GYRO_RATE and ACC_RATE etc in your code.
But your code still seems to work very well. I am just wondering, what's the significance of these GAINS & RATES etc? Is it because of the nature of sensors (Analogue or Digital) or what?