Redboard Artemis Nano - Arduino - digitalWrite with variable

Dear Sparkfun community,

I am trying the Artemis Nano with Arduino, and I have found issues with digitalWrite function.

If I use the pin numbering formad D+# the digitalWrite works properly, the following code pulls HIGH D8 pin, it works properly:

pinMode(D8, OUTPUT);
digitalWrite(D8, HIGH);

The issue comes when I try to use a variable that allow me to rename a certain GPIO pin. The following code does not pull HIGH the D8 pin as expected:

const byte EN_DM_1 = D8;
pinMode(EN_DM_1, OUTPUT);
digitalWrite(EN_DM_1, HIGH);

Could you please suggest any way to rename the PIN D8 with another name? I have done this with other Arduino boards, and it works without issues.

If you write

const int EN_DM_1 = D8;

Do you get the desired result?

It also does not work, I have tried with multiple formats, byte, int, PinName, but none of them works, the only way I can use digitalWrite its with the D8 predefined name.

This is really disapointing, what kind of community - support could someone expect if this takes to much to clarify this very simple question… finally until I was awaiting for any suggestion in this forum, I had to switch the names and keep the same on the board for example “A14” or “D9”. This works properly, but it’s not ideal to rename all the methods associated to those pin names.

Can someone recommend another way I could request support from Sparkfun?

I think this board is amazing, and we would like to use it for our products, but without support it is very scary to develop something based on this.

On an Artemis Nano pin (pin_size_t) 8 is connected to processor pad 38. PinName D8 is defined as 38. With a pinMode or other operation (e.g. digitalWrite()) you can provide EITHER the PinName or pin_size_t.

Assigning D8 to a local PinName (PinName A = D8;) and then doing pinMode(A, OUTPUT); will work. I am surprised it did not work for you, can you try again.

Assigning pin_size_t B = 8; followed by pinMode(B,OUTPUT) will work.

BUT assigning int C = D18; will not work.

Thanks for the suggestion,

I have tried the following:

pin_size_t EN_DM_1 = D8;

void setup() {
  // put your setup code here, to run once:

pinMode(D9, OUTPUT);
digitalWrite(D9, HIGH);

pinMode(EN_DM_1, OUTPUT);
digitalWrite(EN_DM_1, HIGH);

}

void loop() {
  // put your main code here, to run repeatedly:

}

However, when I measure the voltage at the digital pins, the PIN D9 has HIGH, but the PIN D8 has low voltage. I understand, while this code compiles, the pin map address is not being properly set,

Does anyone have any other suggestion? Anybody from SparkFun could investigate how this pin rename can be applied in the Redboard Artemis Nano and Arduino>?

Have again a look at my earlier answer.

you do: pin_size_t EN_DM_1 = D8;

while you should do pin_size_t EN_DM_1 = 8;

NOT D8 but 8 !

D8 can only be used for a PinName variable, NOT a pin_size_t variable.