void setup() {
DDRD |= (1 << 2);
DDRD |= (1 << 3);
DDRD |= (1 << 4);
DDRD &=~(1 << 5);
DDRD &=~(1 << 6);
DDRD &=~(1 << 7);
}
int main() {
int x = 0;
setup();
while (1) {
if(PIND & (1<<5) && x==0)
{
x= 1;
PORTD &= ~(1 << 3);
PORTD &= ~(1 << 4);
PORTD |= (1 << 2);
_delay_ms(600);
}
if(PIND & (1<<5) && x==1)
{
x=2;
PORTD &= ~(1 << 2);
PORTD &= ~(1 << 4);
PORTD |= (1 << 3);
_delay_ms(600);
}
if(PIND & (1<<5) && x==2)
{
x=3;
PORTD &= ~(1 << 2);
PORTD &= ~(1 << 3);
PORTD |= (1 << 4);
_delay_ms(600);
}
if(PIND & (1<<5) && x== 3)
{
x=0;
PORTD &= ~(1 << 2);
PORTD &= ~(1 << 3);
PORTD &= ~(1 << 4);
_delay_ms(600);
}
}
return 0;
}