Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef F_CPU
- #define F_CPU 1000000UL // or whatever may be your frequency
- #endif
- #include <avr/io.h>
- #include <util/delay.h> // for _delay_ms()
- int main(void)
- {
- DDRD = 0b00000100; // initialize port D
- while(1)
- {
- // LED on
- PORTD = 0b00000100; // PD2 = High = Vcc
- _delay_ms(500); // wait 500 milliseconds
- //LED off
- PORTD = 0b00000000; // PD2 = Low = 0v
- _delay_ms(500); // wait 500 milliseconds
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment