How to compile AVR code in Arduino? -
why following code not work in arduino?
#include<avr/io.h> void setup() { ddra = 0xff; } void loop() { porta = 0xaa; _delay_ms(1000); porta = 0x55; _delay_ms(1000); }
i following error. "ddra not declared in scope."
as know, arduino uses avr microcontrollers, why can't use avr code in arduino boards?
user261391 has first issue code. find need include delay.h delay work.
revised example:
#include<avr/io.h> #include<avr/delay.h> void setup() { ddrb = 0xff; } void loop() { portb = 0xaa; _delay_ms(1000); portb = 0x55; _delay_ms(1000); }
Comments
Post a Comment