The First Atmega8 Project

5,487

3

4

Posted

Introduction: The First Atmega8 Project

The eight LEDs will be flash by two groups alternately

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Gluten Free Challenge

    Gluten Free Challenge
  • First Time Author Contest 2018

    First Time Author Contest 2018
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

4 Comments

if this code doesn't work then:

#include<avr/io.h>
#include<util/delay.h>
int main(void)
{
DDRB=0b11111111;
DDRD=0b00000000;
while(1);
{
PORTB=0b10000000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b01000000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00100000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00010000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00001000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00000100;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00000010;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00000001;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b11111111;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

}
}

the code is :

#include<avr/io.h>
#include<util/delay.h>
int main(void)
{
DDRB=0b11111111;
DDRD=0b00000000;
while(PIND=0b00000000);
{
PORTB=0b10000000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b01000000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00100000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00010000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00001000;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00000100;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00000010;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b00000001;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

PORTB=0b11111111;
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

}
}