Paso 3: código
1111111111111 #include < avr/io.h >
#include < util/delay.h >
int main(i,Z,J,Q,A,B,C,D,e,f,g,h,m,n)
{
DDRA = 0XFF;
DDRB = 0XFF;
DDR = 0XFF;
DDRD = 0XFF;
while(1)
{para (i = 128, Z = 1, i > = 1, Z < = 128; me & & Z; i = i/2, Z = Z * 2)
{
Porta| = i;
_delay_ms(20);
PORTD| = Z;
}
para (J = 1, Q = 128, J < = 128, Q > = 16; J & & Q; J = J * 2, Q = Q/2)
{PORTB| = J;
_delay_ms(20);
PORTC| = Q;
}
{PORTA = 0 X 00; PORTB = 0 X 00; PORTC = 0 X 00; PORTD = 0 X 00; _delay_ms(50); } para (A = 128, B = 1, A > = 1, B < = 128; A & & B; A=A/2, B = B * 2)
{PORTA = A;
_delay_ms(20);
PORTD = B;
}
{PORTA = 0b00000000;
PORTD = 0b00000000;
_delay_ms(20);
}
para (C = 1, D = 128, C < = 128, D > = 16; C & & D; C = C * 2, D = D/2)
{
PORTB = C;
_delay_ms(20);
PORTC = D;
}
{
PORTA = 0 X 00; PORTB = 0 X 00; PORTC = 0 X 00; PORTD = 0 X 00; _delay_ms(50);
PORTA = 0XFF; PORTB = 0XFF; PORTC = 0XFF; PORTD = 0XFF; _delay_ms(50);
PORTA = 0 X 00; PORTB = 0 X 00; PORTC = 0 X 00; PORTD = 0 X 00; _delay_ms(50);
PORTA = 0XFF; PORTB = 0XFF; PORTC = 0XFF; PORTD = 0XFF; _delay_ms(50);
}
para (m = 1; m < = 5; m ++)
{
PORTA = 0XFF; PORTB = 0XFF; PORTC = 0XFF; PORTD = 0XFF; _delay_ms(50); para (e = 128, f = 1, e > = 1, f < = 128; e & & f; e = e/2, f = f * 2)
{
PORTA & = ~ e;
_delay_ms(5*m);
PORTD & = ~ f;
}
para (g = 1, h = 128, g < = 128, h > = 16; g & & h, g = g * 2 h = h/2)
{
PORTB & = ~ g;
_delay_ms(50);
PORTC & = ~ h; }}
para (n = 1; n < = 10; n ++)
{
n;
PORTA = 0XFF; PORTB = 0XFF; PORTC = 0 X 00; PORTD = 0 X 00; _delay_ms(20);
PORTA = 0 X 00; PORTB = 0 X 00; PORTC = 0XFF; PORTD = 0XFF; _delay_ms(20);
}
}}