- Fri Apr 12, 2024 8:44 am
#248580
Using the latest Artemis Arduino version, the following code toggles pin 19 but not pin 3:
Code: Select all
If this is rewritten as follows using the native gpio, pin 3 toggles fine.//digitalWrite does not work with pin3 but it does with pin19
void setup() {
pinMode(3, OUTPUT);
pinMode(19, OUTPUT);
}
void loop() {
digitalWrite(19, HIGH);
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(19, LOW);
digitalWrite(3, LOW);
delay(1000);
}
Code: Select all
#include <am_hal_gpio.h>
// This works, both pins 3 and 19 toggle as expected
void setup() {
am_hal_gpio_pinconfig(3, g_AM_HAL_GPIO_OUTPUT);
am_hal_gpio_pinconfig(19, g_AM_HAL_GPIO_OUTPUT);
am_hal_gpio_output_set(3);
am_hal_gpio_output_set(19);
}
void loop() {
am_hal_gpio_output_toggle(3);
am_hal_gpio_output_toggle(19);
delay(1000);
am_hal_gpio_output_toggle(3);
am_hal_gpio_output_toggle(19);
delay(1000);
}