/* counter.c Alexander Hiam Continually counts to 12 using 4 LEDs as a binary display on an ATmega328p or compatible AVR using AVR-GCC. Compare to counter.ino */ #define F_CPU 16000000L #include #include #define LED_DDR DDRB #define LED_PORT PORTB #define LED_MASK (0b1111 << 4) #define RESET_TIMER (timer = 0) int timer; void delay(int ms) { int i; for (i=0; i 12) RESET_TIMER; delay(1000); } return 1; }