Hi,
Please help to understand how to convert gyroscope output to get it ratiometric.

I have a gyroscope: ADXRS401 from SparkFun connected to Arduino.
I read this piece of code from someones' program, who unfortunately didn't like to use parentheses!

from the datasheet of the gyroscope:
Scale Factor: 15mV/deg/sec.

I only know that 5.0/1024.0 is for 4.88mV per bit ADC, and 57.29578 to convert from radian to degree and 1000 is to cancel 'm' which is milli(volt). I am confused by the order of operations: why it is multiplied by 1000/15, shouldn't be 15/1000 as it is the scale factor?

I hate it when the programmers leave out the parens like that -- it's bad form and makes the code harder to read.

As far as figuring out what he is doing, dimensional analysis is your friend. What we need is a conversion factor that changes a given number of LSB units (least significant bit unit) to the related number of radians per second. I.e rad/(s*LSB), so when I multiply it by a given number of LSBs, I get rad/s.

(5 V / 1024 LSB) * 1000 mV/V gives us a value of 4.88 mV/LSB. We know the conversion factor from mV to deg/s is 15 (mVs)/deg. The unit we want out of combining these numbers is deg/(sLSB). In order for that to happen, I need to multiply mV/LSB by a number with units of deg/(mVs)... which means divide by the number 15 in this case. Does that make sense? You can then multiply that by the conversion factor from degrees to radians to get the units you originally wanted, rad/(sLSB).