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

ISR(INT0_vect) {
    PORTB |= (1 << 7);      // Set PB7 high
    _delay_ms(30);          // Prevent bouncing on the button
}

ISR(INT1_vect) {
    PORTB &= ~(1 << 7);    // Set PB7 low
    _delay_ms(30);          // Prevent bouncing on the button
}

int main(void) {
    DDRA = 0xff;                   // Set PORTA as output
    DDRB |= (1 << PB7);         // Enable LED output on PB7
    PORTD |= _BV(PD0) | _BV(PD1); // Enable pull-up on PD0 and PD1
    
    EIMSK |= (1 << INT0) | _BV(INT1); // Enable interrupt for INT0 and INT1
    EICRA |= _BV(ISC01) | _BV(ISC00) | _BV(ISC10) | _BV(ISC11); // Rising edge activates INT0 and INT1

    sei();                          // Enable global interrupts

    while (1) {
        PORTA = 0x00;              // Turn off PORTA initially
        for (unsigned char i = 0; i < 8; i++) {
            PORTA |= (1 << i);     // Display LED pattern on PORTA
            _delay_ms(500);        // Delay for 500 milliseconds
        }
    }
}