user48418: Is the a way to check the status of a bit in an arduino Uno?
Like how in Atmel AVR, there is bit_is_clear or bit_is_set

user-1: Let's say there is a register called r1, and you want to do something if its 6th bit is set to 1. 
Here are two equivalent if statements, both doing the same thing:
if(r1&64){Do something;}
if(r1&(1<<6)){Do something;}


Tiny extra code information:
Let's say you want to do something if r1 = 01XX10XX00 where X means you don't care.
Here are three if statements, all doing the same thing:
if((r1&0b11001100)==(0b01001000)){Do something;}
if((r1&0b11001100)==((1<<6) | (1<<3))){Do something;}
if((r1|0b00110011)==(0b01111011)){Do something;}

If you & (logic and) a 0 somewhere, then you are setting that bit to 0
If you | (logic or) a 1 somewhere, then you are setting that bit to 1

Best of luck on your future ventures. 

user359: you can do it in a single line:
bool isSet = (var & (1 << bitNumber)) != 0;

1 << bitNumber is a bit shift in this case it means that the 1 will be multiplied with the power of 2 
& is the bitwise AND operator. The each bit of the result is 1 if and only if both the corresponding bits in the inputs is 1.

48418: <p>Is the a way to check the status of a bit in an arduino Uno?</p>

<p>Like how in Atmel AVR, there is bit_is_clear or bit_is_set</p>
 -1: <p>Let's say there is a register called <em>r1</em>, and you want to do something if its <em>6th</em> bit is set to <em>1</em>. </p>

<p>Here are two equivalent if statements, both doing the same thing:</p>

<pre><code>if(r1&amp;64){Do something;}
if(r1&amp;(1&lt;&lt;6)){Do something;}
</code></pre>

<hr>

<p>Tiny extra code information:</p>

<p>Let's say you want to do something if r1 = 01XX10XX00 where X means you don't care.</p>

<p>Here are three if statements, all doing the same thing:</p>

<pre><code>if((r1&amp;0b11001100)==(0b01001000)){Do something;}
if((r1&amp;0b11001100)==((1&lt;&lt;6) | (1&lt;&lt;3))){Do something;}
if((r1|0b00110011)==(0b01111011)){Do something;}
</code></pre>

<p>If you &amp; (logic and) a 0 somewhere, then you are setting that bit to 0<br>
If you | (logic or) a 1 somewhere, then you are setting that bit to 1</p>

<hr>

<p>Best of luck on your future ventures. </p>
 359: <p>you can do it in a single line:</p>

<pre><code>bool isSet = (var &amp; (1 &lt;&lt; bitNumber)) != 0;
</code></pre>

<p><code>1 &lt;&lt; bitNumber</code> is a bit shift in this case it means that the 1 will be multiplied with the power of 2 </p>

<p><code>&amp;</code> is the bitwise AND operator. The each bit of the result is 1 if and only if both the corresponding bits in the inputs is 1.</p>
