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
/*
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
Post a Comment