loading
The eight LEDs will be flash by two groups alternately
<p>if this code doesn't work then:</p><p>#include&lt;avr/io.h&gt;<br>#include&lt;util/delay.h&gt;<br>int main(void)<br>{<br>DDRB=0b11111111;<br>DDRD=0b00000000;<br>while(1);<br>{<br>PORTB=0b10000000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b01000000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00100000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00010000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00001000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00000100;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00000010;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00000001;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b11111111;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>}<br>}</p>
<p>the code is :</p><p>#include&lt;avr/io.h&gt;<br>#include&lt;util/delay.h&gt;<br>int main(void)<br>{<br>DDRB=0b11111111;<br>DDRD=0b00000000;<br>while(PIND=0b00000000);<br>{<br>PORTB=0b10000000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b01000000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00100000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00010000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00001000;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00000100;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00000010;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b00000001;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>PORTB=0b11111111;<br>_delay_ms(500);<br>_delay_ms(500);<br>_delay_ms(500);</p><p>}<br>}</p>
code?

About This Instructable

5,394views

3favorites

License:

More by hongyeana:The first Atmega8 Project 
Add instructable to: