Arduino pure C programming part1 Blinking On-Board Led

Code:

/*

Program to blink the on-board led
*/

#include <avr/io.h>
#include <util/delay.h>
int main(void){
DDRB |= (1 << PB5);
while(1) {
PORTB ^= (1 << PB5);
_delay_ms(2000);

}

}


Commands


avr-gcc -mmcu=atmega328p -Wall -Os -o blink.elf blink.c  -DF_CPU=16000000UL

avr-objcopy -j .text -j .data -O ihex blink.elf blink.hex

sudo avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyACM0 -b 115200 -U flash:w:blink.hex 

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig