user14149: 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)));


user10794: Converting Gerben's comment into an answer:

pow(x, 2) is the second power, in other words:


sqrt(x) is the square root of x, that is:


A whole circle is 360 degrees or 2π when measuring in radians. So this ratio of 180 / 3.141592 is used to convert an angle in radians to an angle in degrees.


14149: <p>I'm not the best at Arduino so I'm sorry for my "noobiness".</p>

<p>I'm extending some code that I found online to work on the gyroscope that I'm building.</p>

<p>I'm wondering what the difference is between <code>pow</code> and <code>sqrt</code> in this code.</p>

<p>I'm also wondering what the <code>180/pi</code> is used for. I haven't gotten my mind around this part yet.</p>

<pre><code>arx = (180/3.141592) * atan(ax / pow((ay, 2) + pow(az, 2)); 
</code></pre>

<p>What's the difference here?</p>

<pre><code>ary = (180/3.141592) * atan(ay / sqrt(square(ax, 2) + square(az, 2)));
</code></pre>
 10794: <p>Converting Gerben's comment into an answer:</p>
<hr />
<p>pow(x, 2) is the second power, in other words:</p>
<p><a href="https://i.stack.imgur.com/FxSj7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FxSj7.png" alt="x squared" /></a></p>

<hr />
<p>sqrt(x) is the square root of x, that is:</p>
<p><a href="https://i.stack.imgur.com/LrrbS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LrrbS.png" alt="Square root of x" /></a></p>

<hr />
<p>A whole circle is 360 degrees or 2π when measuring in radians. So this ratio of <code>180 / 3.141592</code> is used to convert an angle in radians to an angle in degrees.</p>
<p><a href="https://i.stack.imgur.com/q7Zfk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q7Zfk.png" alt="radians to degrees" /></a></p>


