Actions

Talk

Avr2011 Programming The Kit: Difference between revisions

From HacDC Wiki

No edit summary
No edit summary
Line 6: Line 6:
  #define F_CPU 8000000UL        
  #define F_CPU 8000000UL        
  #include <util/delay.h>
  #include <util/delay.h>
 
  void main(void){
  void main(void){
   DDRB = 0b11111111;
   DDRB = 0b11111111;
 
   while(1){
   while(1){
     PORTB = 0b11111111;
     PORTB = 0b11111111;
   }   
   }   
  }
  }

Revision as of 06:14, 12 March 2011

I find it helpful to flash the chip with a simple program to turn on all LED's just to ensure all of your LED's work before moving on just in case you put an LED in backwards.

Light Em' Up Program

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

void main(void){
 DDRB = 0b11111111;

 while(1){
   PORTB = 0b11111111;
 }  
}