//press any button to invoke led sequence
#include <stdint.h>
#define DDRA (*(volatile uint8_t*)0x21)
#define PORTA (*(volatile uint8_t*)0x22)
void delay1sec(void){
TCNT1 = 0;
TCCR1A = 0x00;
TCCR1B = 0x05; // prescaler 1024
while (TCNT1 < 15625); // ~1 second
TCCR1B = 0x00;
}
int main(void){
DDRA = 0xFF; // PORT A as output
while(1){
for(uint8_t i = 0; i < 8; i++){
PORTA = (1 << i); // LED sequence 0 → 7
delay1sec();
}
}
}