Blinking an LED with Microcontroller

21 Jan 2013

Put some delay after making the output high and low. Otherwise you won’t see the blinking. Code used is provided below. Comments are used for understanding the code. Do comment if you guys have anything to say.

Code

 /*  
  * Blinking_an_LED.c  
  *  
  * Created: 01-01-2013 AM 11:56:59  
  *  Author: ANANTHAKRISHNAN.U.S  
  */   
   
   
 #include <avr/io.h> 
 #include <util/delay.h> 
 int main(void) 
 { 
     DDRC = 0B00000001;       //Port c0 as output 
   while(1) 
     { 
         PORTC = 0B00000001;  //PCO high 
         _delay_ms(1000); 
         PORTC = 0B00000000;  //PC0 low 
         _delay_ms(1000); 
     } 
 }



Comments