2 + link to port manipulation.
source | link

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.

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.

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.

1
source | link

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.