I'm not the best at Arduino so I'm sorry for my "noobiness".
I'm extending some code that I found online to work on the gyroscope that I'm building.
I'm wondering what the difference is between pow
and sqrt
in this code.
I'm also wondering what the 180/pi
is used for. I haven't gotten my mind around this part yet.
arx = (180/3.141592) * atan(ax / pow((ay, 2) + pow(az, 2));
What's the difference here?
ary = (180/3.141592) * atan(ay / sqrt(square(ax, 2) + square(az, 2)));
pow(x, 2)
is the second power, so x² or x*x.sqrt(x)
is the square root of x, so $\sqrt x$. A whole circle is 360 degrees or 2π when measuring in radians. So this ratio of180/3.141592
is used to convert an angle in radians to an angle in degrees.pow((
topow(
.