I am trying to use a sensor to measure angles of incline on a stationary, flat plane. When I try to convert the raw data to an angle, it doesn't work right. Angle results can range from +/- 30 degrees which is sent from the sensor as a value ranging from 0-2047. I have been given this equation:
angle = arcsin((SensorDataOutput - 1024))/1638
at the bottom of page 12 from my sensor's mfg data sheet:http://www.muratamems.fi/sites/default/files/documents/sca100t_inclinometer_datasheet_8261800a.pdf
My problem code looks like this:
float AxisData; //Stores output value from sensor ranging from 0-2047
float Angle = asin((AxisData -1024.0)/1638.0); //Uses mfg equation to convert to degrees
lcd.print(anglex,4); //Prints conversion to lcd
So for example, the sensor sends a value of 837 to arduino. The equation converts this to -0.1144 degrees. The correct result would be -6.5554 degrees. On the arduino reference on floats, it suggests, to the best of my understanding, that a float can't exceed approximately 3.4. Is this a problem? Any ideas?