conversion between various Arduino cards

In the example (for connections) that I am looking at, it's displayed using a Arduino NANO using pins D2 and D3. The only cards I have are the Arduino MEGA. Therefore, I am looking to know which pins I need to connect to on the Arduino MEGA that represent the D2 and D3 from the NANO.

I have looked up the pin configurations but the several codes next to each pn is a little confusing. I am just getting started with Arduino. I have a couple books to read which I hope will assist. Any assistance is greatly appreciated. Thank you for your time.

Most of the Arduino boards use the same pin names for the pins 0 to 13 and A0 to A5. That means a program using those pins should transfer without problems.

The only thing to watch for is if you are using analogWrite() as the pins it works on do vary from board to board.


The answer depends on the code and WHY those pins were selected. If they're just being used as digital pins then you can use any pin. If they were being used for one of their other purposes like as an interrupt pin or something then you may need to find out what pins serve the same purpose on the other board. You haven't given enough context for anyone here to be able to tell you for sure.

Pins 2 and 3 are like all the other pins on the Nano, except they are also “external interrupt” pins. Fortunately the Mega also has interrupt 0 and 1 on the same two pins, so there should be no problem copying code straight across and connecting to the same pins.