diff --git a/led2/led2.c b/led2/led2.c index 464ab94..d4a07f8 100644 --- a/led2/led2.c +++ b/led2/led2.c @@ -2,24 +2,28 @@ #include #include -#define DELAY 50 -#define BITS sizeof(PORTB) * CHAR_BIT - 1 +#define DELAY 75 +#define LEN sizeof(PORTB) * CHAR_BIT - 1 +#define LED_DDR DDRB +#define LED_PORT PORTB int main(void) { - int i; + uint8_t i; - DDRB = 0xff; - - PORTB = 1; + LED_DDR = 0xff; for (;;) { - for (i = 0; i < BITS; i++) { + for (i = 0; i < LEN; i++) { _delay_ms(DELAY); - PORTB = PORTB << 1; + LED_PORT = (1 << i); + // LED_PORT = ~(1 << i); + // LED_PORT |= (1 << i); } - for (i = BITS; i > 0; i--) { + for (i = LEN; i > 0; i--) { _delay_ms(DELAY); - PORTB = PORTB >> 1; + LED_PORT = (1 << i); + // LED_PORT = ~(1 << i); + // LED_PORT |= (1 << i); } }