27 lines
583 B
C
27 lines
583 B
C
#include <stdint.h>
|
|
#include <avr/io.h>
|
|
#include <util/delay.h>
|
|
|
|
volatile uint8_t led[3] = {(1<<PB3)|(1<<PB0),(1<<PB4)|(1<<PB0),(1<<PB5)|(1<<PB0)};
|
|
volatile uint8_t motor[6] = {
|
|
(1<<PD4)|(1<<PD1),(1<<PD2)|(1<<PD1),
|
|
(1<<PD2)|(1<<PD5),(1<<PD0)|(1<<PD5),
|
|
(1<<PD0)|(1<<PD3),(1<<PD4)|(1<<PD3)
|
|
|
|
};
|
|
|
|
int main(void) {
|
|
DDRB |= (1<<PB3) | (1<<PB4) | (1<<PB5) | (1<<PB0);
|
|
DDRD |= 0b11111111;
|
|
PORTB |= (1<<PB0);
|
|
while(1) {
|
|
for(uint8_t i=0;i<6;i++) {
|
|
PORTB |= led[i%3];
|
|
PORTD |= motor[i];
|
|
_delay_ms(5);
|
|
PORTB &= ~(led[i%3]);
|
|
PORTD = 0;
|
|
}
|
|
}
|
|
}
|