Search code examples
androidorientationaccelerometersensors

Orientation Sensor Accelerometer for Spirit Level


I am developing a spirit level. Currently I use the x and y values of the accelerometer. I do not use the z value. In general it works, but it isnt very smooth.

Would it be a better solution to use the orientation sensor or maybe both?


Solution

  • The solution that I used was a scaling factor which is what midoalageb suggested. I use a scale factor of 0.5 so essentially the sensor value is cut in half. This makes the jitters less noticeable. This also slows the bubble down a bit so that it doesn't seem like it is jumping from one end to the other when tilting the device.