Arduino sin IDE

De fabwiki
Ir a la navegación Ir a la búsqueda
avra prog.asm
avrdude -p m328p -c arduino -P /dev/tty.usbserial-A5069RR4 -U flash:w:prog.hex:i -D

https://github.com/antonyak/arduino-uno-avr-toolchain

Blink

#include <avr/io.h>
#include <util/delay.h>

int main (void){
  DDRB = 0xFF;
  while(true){
    _delay_ms(200);
    PORTB = 0xFF;
    _delay_ms(200);
    PORTB = 0x00;
  }
}

Generar 8 MHz

#include <avr/io.h>

int main (void){
  TCCR1A = _BV (COM1A0); 
  TCCR1B = _BV(WGM12) | _BV(CS10); 
  OCR1A =  0; 
  DDRB = 0xFF;
 }