32 lines
626 B
C
32 lines
626 B
C
#include <avr/io.h>
|
|
#include <util/delay.h>
|
|
#include <limits.h>
|
|
|
|
#define DELAY 75
|
|
#define LEN sizeof(PORTB) * CHAR_BIT - 1
|
|
#define LED_DDR DDRB
|
|
#define LED_PORT PORTB
|
|
|
|
int main(void) {
|
|
uint8_t i;
|
|
|
|
LED_DDR = 0xff;
|
|
|
|
for (;;) {
|
|
for (i = 0; i < LEN; i++) {
|
|
_delay_ms(DELAY);
|
|
LED_PORT = (1 << i);
|
|
// LED_PORT = ~(1 << i);
|
|
// LED_PORT |= (1 << i);
|
|
}
|
|
for (i = LEN; i > 0; i--) {
|
|
_delay_ms(DELAY);
|
|
LED_PORT = (1 << i);
|
|
// LED_PORT = ~(1 << i);
|
|
// LED_PORT |= (1 << i);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|