/*
 * blinky.cpp
 *
 * Created: 17.3.2017 17:11:10
 * Author : omistaja
 */ 

#include <avr/io.h>
#define LOW 0
#define HIGH 1

#define INPUT(port,pin) DDR ## port &= ~(1<<pin)
#define OUTPUT(port,pin) DDR ## port |= (1<<pin)
#define CLEAR(port,pin) PORT ## port &= ~(1<<pin)
#define SET(port,pin) PORT ## port |= (1<<pin)
#define TOGGLE(port,pin) PORT ## port ^= (1<<pin)
#define READ(port,pin) (PIN ## port & (1<<pin))

int main(void)
{
    /* Replace with your application code */
    while (1) 
    {
//PORTA = (1<<PA3)|(1<<PA2)|(1<<PA7);
PORTB = (1<<PB2);
//DDRA = (1<<DDA3)|(1<<DDA2)|(1<<DDA7);
DDRB = (1<<DDB2);
INPUT(A,3);
INPUT(A,2);
INPUT(A,7);
if (READ(A,3)==LOW)
{
	DDRA = (1<<DDA3);
	PORTA = (1<<PA3);
}
if(READ(A,2)==LOW)
	{
		DDRA = (1<<DDA2);
		PORTA = (1<<PA2);
    }
	if(READ(A,7)==LOW)
	{
		DDRA = (1<<DDA7);
		PORTA = (1<<PA7);
	}
	
	}
}

