#include <avr/io.h>
int main()
{
init();
DDRD = 0x00;//configure DDRD1, pin 2 as input
DDRB = 0x20;
PORTD = 0x04;//configure to use pull up resistor
//PORTB = 0x20;
Serial.begin(9600);//set serial to 9600 bps
do{
byte input=PIND & 0x04; //read pin 2 in port D
input = input >> 2;
Serial.println(input);
if (input == 0){
PORTB = 0x20;
}
else {
PORTB = 0x00;
}
}while(true);
}