How can I get device's rotation in degrees?

370 Views Asked by At

I wan't to create a bubble level, gyroscope app, but Accelerometer is not giving the right values to convert to degrees.

Should I use Acceletormeter? Or which sensor can do this for me?

For the bubble level part, I did this:

var x = (acceleration.X * 90f).ToString("0.0°");
var y = (acceleration.Y * 90f).ToString("0.0°");

And for the gyroscope part, I did this:

var x = (acceleration.X * 90f).ToString("0.0°");
var y = (acceleration.Z * 90f).ToString("0.0°");
1

There are 1 best solutions below

4
On

you're using the wrong API

The OrientationSensor class lets you monitor the orientation of a device in three dimensional space.