Last active
February 24, 2016 03:00
-
-
Save owskio/bcba322a4b95beec3002 to your computer and use it in GitHub Desktop.
Atmel 328p AVR LED blink simple
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
/* | |
sudo avr-gcc -Wall ledBlinkSimple.c -mmcu=atmega328p -o ledBlinkSimple.o | |
sudo avr-objcopy -O ihex -R .eeprom ledBlinkSimple.o ledBlinkSimple.hex | |
sudo avrdude -p atmega328p -c avrisp2 -U flash:w:ledBlinkSimple.hex -P /dev/ttyACM0 | |
*/ | |
#define F_CPU 1000000UL //Tell delay.h we're running the default 1 MHz | |
#include <avr/io.h> | |
#include <util/delay.h> | |
int main(void) { | |
DDRC = 0xFF; | |
while(1) { | |
PORTC = 0xFF; //all pins up | |
_delay_ms(100); | |
PORTC= 0x00; //all pins down | |
_delay_ms(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment