Advertisement
Guest User

Untitled

a guest
Apr 19th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <avr/io.h>
  2. #include <util/delay.h>
  3.  
  4. enum {
  5.  BLINK_DELAY_MS = 1000,
  6. };
  7.  
  8. int main (void)
  9. {
  10.  /* set pin 5 of PORTB for output*/
  11.  DDRB |= _BV(DDB5);
  12.  
  13.  while(1) {
  14.   /* set pin 5 high to turn led on */
  15.   PORTB |= _BV(PORTB5);
  16.   _delay_ms(BLINK_DELAY_MS);
  17.  
  18.   /* set pin 5 low to turn led off */
  19.   PORTB &= ~_BV(PORTB5);
  20.   _delay_ms(BLINK_DELAY_MS);
  21.  }
  22.  
  23.  return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement