Actions

Talk

Avr2011 Programming The Kit: Difference between revisions

From HacDC Wiki

No edit summary
No edit summary
 
Line 3: Line 3:
Light Em' Up Program
Light Em' Up Program


  #include <avr/io.h>
  #include <avr/io.h> /* AVR library to define pins, ports, etc */
  void main(void){
  int main(void)
  DDRB = 0b11111111;
{
  while(1){
DDRB = 0xff; //Set port B pins as all outputs
    PORTB = 0b11111111;
PORTB = 0xff; //Set all Port B pins as High
  } 
return 1;
  }
  }

Latest revision as of 23:45, 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> /* AVR library to define pins, ports, etc */
int main(void)
{
	DDRB = 0xff;  //Set port B pins as all outputs
	PORTB = 0xff; //Set all Port B pins as High
	return 1;
}