int main() {
DDRB &= ~(1 << 0);
//PORTB |= (1 << 0);
DDRC |= (1 << 0);
uint8_t x = 0;
uint8_t prev_state = 0;
while (1) {
uint8_t current_state = PINB & (1 << 0);
if (current_state && !prev_state) {
x += 1;
if(x > 3){
x = 0;}
}
if (x == 1) {
PORTC |= (1 << 0);
} else if (x == 2) {
PORTC &= ~(1 << 0);
} else if (x == 3) {
PORTC ^= (1 << 0);
_delay_ms(1000);
}
_delay_ms(50);
prev_state = current_state;
}
}