#define PIND *((volatile char*)(0x29)) /* Input Pins, Port D */ #define DDRD *((volatile char*)(0x2A)) /* Data Direction Register, Port D */ #define PORTD *((volatile char*)(0x2B)) /* Data register, Port D */ #define DDRB *((volatile char*)(0x24)) /* Data Direction Register, Port B */ #define PORTB *((volatile char*)(0x25)) /* Data register, Port B */ void leds_on(char val) { PORTB = val; } char buttons_chk() { return PIND; } int main(void) { DDRB = 0xFF; // Set PORTB to output PORTB = 0x00; // Turn off LEDs DDRD = 0x00; // Set PORTD to input PORTD = 0x00; // Turn off pull-up resistor while (1) leds_on(buttons_chk()); return 0; }