//BLINKING FROM LEFT TO RIGHT
#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 (uint8_t i = 0; i < 8; i++) {
PORTA = (1 << i); // Row 1 LED
PORTB = (1 << i); // Row 2 LED
delay1sec();
}
}