/* taster_02.c ATmega88 @ 8MHz */
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
	DDRB = (1<<PB0);					// PORTB Pin0 = Ausgang
	DDRD = ~((1<<PIND0)|(1<<PIND1));	// PORTD PIN0 und PIN1 = Eingang
	PORTD |= (1<<PD0);					// internen Pull-Up Widerstand aktivieren
	
	while(1)
	{
		if (!(PIND & (1<<PIND0)))		// Wenn Taster = LOW
		{
			PORTB |= (1<<PB0);			// LED = ON
		}
		
		else if (PIND & (1<<PIND1))		// Wenn Taster = HIGH
		{
			PORTB &= ~(1<<PB0);			// LED = OFF
		}
	}
}