#include #include //C is incomplete; there's no port A //B and D are 8 bit ports //AtoD is on port C int main(){ int lsb; int b; long k; DDRD=0xff; /* use port D as output */ DDRB=0x00; /* use port B as input with no pullup resistors */ //DDRB=0xff; /* use port B as input with pullup resistors (i.e. as if output) */ for (k=0;k<90000;k++); while (1){ lsb = (PINB<<7); if (lsb==0) b=0x00; if (lsb==128) b=0xff; PORTD=b; //for (k=0;k<5000;k++); //PORTD=~b; //for (k=0;k<5000;k++); } }