Get pin input status without using the arduino library
For reading, e.g., PB2, you would test

PINB &amp; _BV(PB2)


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

C.f. the datasheet for the relevant port names.

See also the Arduino tutorial on
port manipulation.