#include #include /* Blinks two LEDs; one on B1 and one on B0. Assumes negative PINs of LEDs are connected to the AVR micro-controller. Positive pins are connected through resistors to VCC. As a result, all logic is inverted from previous versions. A 1K resistor works well for most LEDs. Decrease if too dim. */ #define LED_ON(port, nr) port &= ~(1 << (nr)) #define LED_OFF(port, nr) port |= (1 << (nr)) int main(void) { DDRB = 255U; // Make all PB* -- PORT B -- pins output PORTB = 0xFF; // turn all PB* -- PORT B -- pins off. while (1) { LED_ON(PORTB, PB0); _delay_ms(200); LED_ON(PORTB, PB1); _delay_ms(100); LED_OFF(PORTB, PB0); _delay_ms(200); LED_OFF(PORTB, PB1); _delay_ms(2500); // 2.5 seconds off } }