Just use the atan2(Y-Axis Value , X-Axis Value) Multiply the result by 180/M_PI for >=0 and by -180/M_PI for <=0