From 39e5e4f272bd5fb6b63505a0a3f39661a69cdd29 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sun, 16 May 2021 16:53:56 -0500 Subject: [PATCH] More things --- led2/led2.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) 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); } }