Blinking LED Programming Project For ATmega 16

post footer border

We all have seen the blinking lights in christmas and diwali. But very few of us really know or wanted to know how it works.

This Project helps you to make similar type of device by using ATmega16.

In this project we are using 8 LEDS and ATmega8 dev board v1.0 to make blinking LED device 

CODE :

#include<avr/io.h>
#include<util/delay.h>
#define F_CPU 1000000UL

void wait(float x)
{
for(int i=0;i<(int)(x*1302);i++)
_delay_loop_1(0);

}


main()
{
int i=0;
DDRC=0xFF;   // PORT B as output port
while(1)
{
PORTC=0b11111111;
_delay_ms(100);
   
PORTC=0b00000000;
    
_delay_ms(100);
}

}


Here <avr/io.h> is the avr Local directory 

We using <util/delay.h> for delay

DDRD=0xFF;  Here we using PORTD as Output port

_delay_ms(100);    we giving a delay of 100 milliseconds.




To download the whole Project ( including c source, asp and .hex ) Click here:

BlinkingLED.rar
BlinkingLED.rar






Recent Posts