Porting Arduino code to AVR/C++ input not working? So. I'm trying to read an input on the Arduino Nano using C++/AVR/Eclipse instead of the regular arduino IDE.
The code below is working in the arduino IDE

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
  pinMode(5, INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(digitalRead(5)){
    digitalWrite(13,1);
  }else{
    digitalWrite(13,0);
  }
}


I'm porting the code to AVR/C++ in Eclipse, regular blinking leds is working... but I can't read inputs for some reason...

#define F_CPU 16000000UL //16MHz
#include &lt;avr/io.h&gt;
#include &lt;util/delay.h&gt;

#define set_bit(Y,bit_x) (Y|=(1&lt;&lt;bit_x))
#define clear_bit(Y,bit_x) (Y&amp;=~(1&lt;&lt;bit_x))
#define isset_bit(Y,bit_x) (Y&amp;(1&lt;&lt;bit_x))
#define toggle_bit(Y,bit_x) (Y^=(1&lt;&lt;bit_x))

int main( ){
    DDRB = 0xFF;//Setting all portB pins to output (D13/PB5 - LED)
    DDRD = 0x00;//Setting all portD pins to input  (D5 /PD5 - INPUT)

    while(1){
        if(isset_bit(PORTD,PD5)){//if input... doesn't work?
            set_bit(PORTB,PB5);//Set output (Tested to be working)
        }else{
            clear_bit(PORTB,PB5);//Clear output
        }
    }
}
During the creation of this question I found out the answer... Though I wanted to share it with you guys for later reference.
It has been quite a time since I have worked with AVR. 

You should read pins from PINx

You should set pins in PORTx

Set DDRx to 1 for OUTPUT and to 0 for INPUT

^ This is fun because PIC/Microchip MCU's use 1 for input and 0 for output.

See code below:

#define F_CPU 16000000UL
#include &lt;avr/io.h&gt;
#include &lt;util/delay.h&gt;

#define set_bit(Y,bit_x) (Y|=(1&lt;&lt;bit_x))
#define clear_bit(Y,bit_x) (Y&amp;=~(1&lt;&lt;bit_x))
#define isset_bit(Y,bit_x) (Y&amp;(1&lt;&lt;bit_x))
#define toggle_bit(Y,bit_x) (Y^=(1&lt;&lt;bit_x))

int main( ){
    DDRB = 0xFF;
    DDRD = 0x00;

    while(1){
        if((PIND&amp;(1&lt;&lt;PD5))){
            set_bit(PORTB,PB5);
        }else{
            clear_bit(PORTB,PB5);
        }
    }
}