Created
January 21, 2014 19:36
-
-
Save mondalaci/8546834 to your computer and use it in GitHub Desktop.
Trivial blink program for AVR microcontrollers. Useful for figuring out whether the fuses are set right. If not then the LED will blink at intervals other than one second.
This file contains hidden or 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
// To be compiled with: (replace values if needed) | |
// avr-gcc -mmcu=atmega88 -DF_CPU=16000000UL blink.c -Os -oblink && avr-objcopy -O ihex blink.elf blink.hex | |
#include <avr/io.h> | |
#include <util/delay.h> | |
int main(void) | |
{ | |
DDRB |= 1<<DDB0; | |
while (1) { | |
_delay_ms(1000); | |
PORTB = 0xff; | |
_delay_ms(1000); | |
PORTB = 0x00; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment