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

ISR(PCINT0_vect) {
    PORTB |= (1 << 7);       // Set PB7 high
    _delay_ms(1000);         // Delay for 1 second
    PORTB &= ~(1 << 7);     // Set PB7 low
}

int main(void) {
    DDRA = 0xff;               // Set PORTA as output

    DDRB |= (1 << PB7);       // Enable LED output on PB7
    PORTB |= (1 << PB4);    // Enable pull-up on pin PCINT4
    PCMSK0 |= (1 << PCINT4); // Enable interrupt for PCINT4
    PCICR |= _BV(PCIE0);     // Enable Pin Change Interrupt for PCINT0
    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
        }
    }
}