Skip to content
Snippets Groups Projects
Verified Commit 45fadd58 authored by Benedikt Wildenhain's avatar Benedikt Wildenhain
Browse files

init

parents
No related branches found
No related tags found
No related merge requests found
#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);
}
}
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o led.o led.c
avr-gcc -mmcu=atmega328p led.o -o led
avr-objcopy -O ihex -R .eeprom led led.hex
avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyACM0 -b 115200 -U flash:w:led.hex
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment