More things

This commit is contained in:
Ryan Cavicchioni 2021-05-16 16:53:56 -05:00
parent 59f6501ea8
commit 39e5e4f272
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -2,24 +2,28 @@
#include <util/delay.h> #include <util/delay.h>
#include <limits.h> #include <limits.h>
#define DELAY 50 #define DELAY 75
#define BITS sizeof(PORTB) * CHAR_BIT - 1 #define LEN sizeof(PORTB) * CHAR_BIT - 1
#define LED_DDR DDRB
#define LED_PORT PORTB
int main(void) { int main(void) {
int i; uint8_t i;
DDRB = 0xff; LED_DDR = 0xff;
PORTB = 1;
for (;;) { for (;;) {
for (i = 0; i < BITS; i++) { for (i = 0; i < LEN; i++) {
_delay_ms(DELAY); _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); _delay_ms(DELAY);
PORTB = PORTB >> 1; LED_PORT = (1 << i);
// LED_PORT = ~(1 << i);
// LED_PORT |= (1 << i);
} }
} }