//glow the led in the following pattern 0,1,2 5,6,7 3,4
#include <stdint.h>
#define DDRA (*(volatile uint8_t*)0x21)
#define PORTA (*(volatile uint8_t*)0x22)
uint8_t pattern[3] = {
0x07, // 0,1,2
0xE0, // 5,6,7
0x18 // 3,4
};
void delay1sec(void){
TCNT1 = 0;
TCCR1A = 0x00;
TCCR1B = 0x05;
while (TCNT1 < 15625);
TCCR1B = 0x00;
}
void setup() {
DDRA = 0xFF;
}
void loop() {
for (uint8_t i = 0; i < 3; i++) {
PORTA = pattern[i];
delay1sec();
PORTA = 0x00;
delay1sec();
}
}