// reverse the pair blinking
#include <stdint.h>
#define DDRA (*(volatile uint8_t*)0x21)
#define PORTA (*(volatile uint8_t*)0x22)
#define DDRB (*(volatile uint8_t*)0x24)
#define PORTB (*(volatile uint8_t*)0x25)
void delay1sec(void){
TCNT1 = 0;
TCCR1A = 0x00;
TCCR1B = 0x05; // prescaler 1024
while (TCNT1 < 15625);
TCCR1B = 0x00;
}
void setup() {
DDRA = 0xFF; // Row 1 output
DDRB = 0xFF; // Row 2 output
}
void loop() {
for (int8_t i = 6; i >= 0; i -= 2) {
uint8_t mask = (0x03 << i); // pair mask
PORTA = mask; // Row 1
PORTB = mask; // Row 2
delay1sec();
}
}