The First Atmega8 Project

Introduction: The First Atmega8 Project

The eight LEDs will be flash by two groups alternately

Be the First to Share

    Recommendations

    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge

    4 Discussions

    0
    arhamm
    arhamm

    5 years ago on Introduction

    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);

    }
    }

    0
    arhamm
    arhamm

    5 years ago on Introduction

    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);

    }
    }