PIN number to use with arduino nano

Hello folks,

I have already used some arduino UNO boards, but never nano boards.

I planned to use a nano in a project of a temperature regulator that I am working on.

But, imagine that I would like to set the DO4 pin as an output and I would like to set this pin to 1.

I have to write :

digitalWrite(4,high);

Or

DigitalWrite(7,high);

I think that is a common question but a didn't found an answer yet....

Thank you in advance.

Maxime.

What makes you think you would use 7?

It's HIGH, not high.

It's digitalWrite, not DigitalWrite.

Precision is extremely important in programming. Please read:

You need to set the pinMode. Please read:

Yes, I know but the question was not about the syntax but about the PIN number to use.

Please look at the attached picture. The D04 pin is the seventh pin of the board. (Unlike the arduino uno where the D01 is on the first pin).

My question is : if I want to use the D04 as an output, have I to call it by the "4" of D04 or the "7" of the pin number ?

The Arduino number for the (7) pin is, and always has been, 4. The numbering of the pins down one side and up the other is for breadboarding purposes.

You could have attached an LED to D4 and one to pin (7), and tried turning pins 4 and 7 on in code, and observed which one actually lit up in less time than it took to do all this posting and arguing.

Ok, thank you for the answer.

Yes, it could be the best and fastest solution, I agree, but Currently I don't have a nano board to make this experiment.

Anyway. Thank you again.

Regards,
Maxime.

If you are using an Arduino board of any kind just use the pin numbers printed on the board and ignore which pins they relate to on the chip.

If you are designing a PCB to hold the processor chip or have it in a breadboard then you have to concern yourself with the chip pin numbers and how they relate to the Arduino pin numbers but not otherwise.