Arduino nano digitalwrite pinnumbers.

Hi i want to give an output from D4 and D5 pins

should i write digitalWrite(4, HIGH); or digitalWrite(7, HIGH);

it is D4 but its 7th pin of the nano as it stated here http://www.circuitstoday.com/arduino-nano-tutorial-pinout-schematics

Always use 4 (sometimes called D4) and A0 and so on. That is also the label of the pins (the white text on the PCB). Use the name or label of the pin.
The Arduino Uno pin 4 (or D4) is the same as the Nano pin 4 (or D4).

Not every Arduion Nano is the same, but if you use pin 4 (or D4) and A0 and so on, then it is always the same pin.

I think you found the only one page that is confusing the pin numbers. It is possible to number the pins, starting in a corner, but no one does that.

Use the numbers that are printed on your nano board. Here's a picture & a link:

nano.jpg

Actually, that's pin 22 of the board, using standard pin numbering schema. (Pin 1 of any board or chip, is where pin 13 is on this one, then count counter-clockwise.) Board/chip numbers are not used as pin numbers by Arduino. Use the assigned numbers, as seen above.