Hi freaks,
I bought an Arduino due and I am trying to run a blink program on it. This is my program:
#include#include #define MY_LED IOPORT_CREATE_PIN(PIOC, 22) int main (void) { board_init(); ioport_init(); delay_init(F_CPU); ioport_set_pin_dir(MY_LED, IOPORT_DIR_OUTPUT); ioport_set_pin_level(MY_LED, LOW); while(1){ delay_s(1); ioport_set_pin_level(MY_LED, HIGH); delay_s(1); ioport_set_pin_level(MY_LED, LOW); } }
I am programming it with a jlink-edu, with SWD debugging interface. The same program in Arduino IDE works:
int led = 8; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
what could be the problem?