#define F_CPU 4000000UL
#include <avr/io.h>
#include <util/delay.h>
void left (int n);
void delay(int m);
int main(void)
{
DDRD=0x0F;
PORTD=0x00;
int t=0;
while (1)
{
for (t=0; t<100;t++)
{
left((01-t));
}
for (t=0;t<100;t++)
{
left(t);
}
}
}
}
void left (int n)
{
PORTD=0b00000011;
delay(n);
PORTD=0b00000010;
delay(n);
PORTD=0b00000110;
delay(n);
PORTD=0b00000100;
delay(n);
PORTD=0b00001100;
delay(n);
PORTD=0b00001000;
delay(n);
PORTD=0b00001001;
delay(n);
PORTD=0b00000001;
delay(n);
}
void delay(int m)
{
int i=0;
for (i=0; i<m;i++)
{
_delay_ms(2);
}
}