Avr2011 Programming The Kit: Difference between revisions
From HacDC Wiki
Jamestford (talk | contribs) (Verify All LED's Working) |
Jamestford (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
Light Em' Up Program | Light Em' Up Program | ||
#include <avr/io.h> | #include <avr/io.h> | ||
#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; | ||
Line 13: | Line 13: | ||
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; } }