Pololu USB AVR User Manual
Page 14

2. In the Device Selection window, select the device name of your specific AVR. Click OK to create the project.
The Device Selection dialog of Atmel Studio 6.
3. Remove the template code that was automatically placed in BlinkLED.c and replace it with the code below:
#define F_CPU 20000000 // AVR clock frequency in Hz, used by util/delay.h
#include <avr/io.h>
#include <util/delay.h>
int main() {
DDRD |= (1<<DDD1); // set LED pin PD1 to output
while (1) {
PORTD |= (1<<PORTD1); // drive PD1 high
_delay_ms(100); // delay 100 ms
PORTD &= ~(1<<PORTD1); // drive PD1 low
_delay_ms(900); // delay 900 ms
}
}
Note: The value of F_CPU should be the clock frequency of your AVR in units of Hz, so if your AVR
is not running at 20 MHz you will need to change that line. If you do not make this change, the timing
of
_delay_ms()
will be off, but the LED will still blink.
4. Click the Build Solution button on the toolbar (or press F7) to compile the code.
Pololu USB AVR Programmer User's Guide
© 2001–2014 Pololu Corporation
3. Getting Started in Windows
Page 14 of 54