Skip to content

Instantly share code, notes, and snippets.

@lopesivan
Forked from tokolist/gist:5387210
Created October 16, 2017 13:27
Show Gist options
  • Save lopesivan/da491683b9abf95d71cae193f5aea48e to your computer and use it in GitHub Desktop.
Save lopesivan/da491683b9abf95d71cae193f5aea48e to your computer and use it in GitHub Desktop.
AVR Microcontroller Hello World (LED Blink) http://youtu.be/smsW95zcFfE
#define F_CPU 1000000 //1MHz
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRC |= (1<<DDC5); // set LED pin PC5 to output
while(1)
{
PORTC |= (1<<PORTC5); // drive PC5 high
_delay_ms(500); // delay 500 ms
PORTC &= ~(1<<PORTC5); // drive PC5 low
_delay_ms(500); // delay 500 ms
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment