Guest User

Untitled

a guest
Feb 2nd, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #ifndef F_CPU
  2. #define F_CPU 1000000UL // or whatever may be your frequency
  3. #endif
  4.  
  5. #include <avr/io.h>
  6. #include <util/delay.h>                // for _delay_ms()
  7.  
  8. int main(void)
  9. {
  10.     DDRD = 0b00000100;                       // initialize port D
  11.     while(1)
  12.     {
  13.         // LED on
  14.         PORTD = 0b00000100;            // PD2 = High = Vcc
  15.         _delay_ms(500);                // wait 500 milliseconds
  16.  
  17.         //LED off
  18.         PORTD = 0b00000000;            // PD2 = Low = 0v
  19.         _delay_ms(500);                // wait 500 milliseconds
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment