#include <avr/io.h>
	#include <util/delay.h>

	int main(void) {

	   // enable pull up resistor
	   //DDRA &= ~(1 << PA7);
		 DDRB |= (1 << PB1);
		 DDRA |= (1 << PA2);
	   PORTA |= _BV(PA7);
		 PORTB &= ~(1 << PB1);
		 //PORTB |= _BV(PB2);

	   //set clock multiplier to be 1
		 //CLKPR = (1 << CLKPCE);

	   while (1) {

			if ((PINA&(_BV(PA7)))==0){
			PORTB |= (1 << PB1);
			PORTA |= (1 << PA2);
		  _delay_us(100);
		  PORTB &= ~(1 << PB1);
			PORTA &= ~(1 << PA2);
			_delay_us(550);
		  // flash with 200ms period when button is pressed.
		}else{

			PORTB &= ~(1 << PB1);
			PORTA &= ~(1 << PA2);
			//_delay_ms(100);

		  // flash with 800ms period when not pressed.
	    }
		}
		//return (0);
	}
