Created
September 21, 2015 15:56
-
-
Save amriunix/8e0809c7ab524f34f015 to your computer and use it in GitHub Desktop.
Blink Arduino C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <util/delay.h> | |
#define BLINK_DELAY_MS 1000 | |
int main (void) | |
{ | |
/* set pin 5 of PORTB for output*/ | |
DDRB |= _BV(DDB5); | |
while(1) { | |
/* set pin 5 high to turn led on */ | |
PORTB |= _BV(PORTB5); | |
_delay_ms(BLINK_DELAY_MS); | |
/* set pin 5 low to turn led off */ | |
PORTB &= ~_BV(PORTB5); | |
_delay_ms(BLINK_DELAY_MS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment