locked
Calculating degree from Accelerometer XY Values RRS feed

  • Question

  • I am playing about with the Accelerometer and want to interpret my X, Y values as a degree (angle) value. ie somewhere between 0 and 360.

    How can I do this?

    Wednesday, October 2, 2013 2:09 PM

Answers

  • You can use basic trigonometry:

    SOHCAHTOA 
    Tangent(theta) = Opposite/Adjacent.

    View your X and Y are the sides of a right triangle with your angle theta at the origin:
    Theta = arctan(X/Y).

    --Rob

    Wednesday, October 2, 2013 3:17 PM