user27151: I am not allowed to use the Arduino Library (or any Library) for this program. How would I check the input of a pin? 
I found two different functions: 
In Arduino.h:
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)

Following digitalRead back to pgmspace.h:
#define __LPM_enhanced__(addr)  \
(__extension__({                \
    uint16_t __addr16 = (uint16_t)(addr); \
    uint8_t __result;           \
    __asm__ __volatile__        \
    (                           \
        "lpm %0, Z" "\n\t"      \
        : "=r" (__result)       \
        : "z" (__addr16)        \
    );                          \
    __result;                   \
}))

For the first one, I don't know where bit and value come from and I just don't understand the second one at all. 

user7508: For reading, e.g., PB2, you would test
PINB & _BV(PB2)

where PINB is the port input register and _BV(x) is a macro defined as
(1 << (x)).
C.f. the datasheet for the relevant port names.
See also the Arduino tutorial on
port manipulation.

27151: <p>I am not allowed to use the Arduino Library (or any Library) for this program. How would I check the input of a pin? </p>

<p>I found two different functions: </p>

<p>In Arduino.h:</p>

<pre><code>#define bitRead(value, bit) (((value) &gt;&gt; (bit)) &amp; 0x01)
</code></pre>

<p>Following digitalRead back to pgmspace.h:</p>

<pre><code>#define __LPM_enhanced__(addr)  \
(__extension__({                \
    uint16_t __addr16 = (uint16_t)(addr); \
    uint8_t __result;           \
    __asm__ __volatile__        \
    (                           \
        "lpm %0, Z" "\n\t"      \
        : "=r" (__result)       \
        : "z" (__addr16)        \
    );                          \
    __result;                   \
}))
</code></pre>

<p>For the first one, I don't know where bit and value come from and I just don't understand the second one at all. </p>
 7508: <p>For reading, e.g., PB2, you would test</p>

<pre><code>PINB &amp; _BV(PB2)
</code></pre>

<p>where PINB is the port input register and <code>_BV(x)</code> is a macro defined as
<code>(1 &lt;&lt; (x))</code>.</p>

<p>C.f. the datasheet for the relevant port names.</p>

<p>See also the Arduino tutorial on
<a href="https://www.arduino.cc/en/Reference/PortManipulation" rel="nofollow">port manipulation</a>.</p>
