Arduino Mega 2560, what all pins can I use?

I have Arduino Mega 2560 and want to use 12 pins for output, particularly for giving instructions to 6 stepper motor drives (i.e. a4988 and the information is number of steps and direction). My question is that what all pins I can use? Can i use the pins 22 to 53 in the same way i use the pins 2 to 12? is there any difference between these two different set of pins (2 to 12 and 22 to 53)?

My question is that what all pins I can use?

Any pin that is not already being used.

Can i use the pins 22 to 53 in the same way i use the pins 2 to 12?

Yes.

is there any difference between these two different set of pins (2 to 12 and 22 to 53)?

There are at 90 degrees to each other.

So, there is no need to worry. Thanks and by the way what is the use of other pins like pins 0,1 adn 14 to 21 which has something written above like tx0 or rx0 and all?
Thanks

palashrc0945:
what is the use of other pins like pins 0,1 adn 14 to 21 which has something written above like tx0 or rx0 and all?

Look at this http://arduino.cc/en/Main/ArduinoBoardMega2560 and all will be revealed.

After reading from the above link i can say that not all the pins from 22 to 53 are same. Pins 2 to 13 and 44 to 46 are same but i think that there is some difference in pins 22 to 43. I don't know.

One more question, can I use pin 13 as the pin connected to the direction pin of the a4988 stepper motor drive? Will it make the motors to work improperly?

Check out the Stepper.h library as well.

palashrc0945:
One more question, can I use pin 13 as the pin connected to the direction pin of the a4988 stepper motor drive? Will it make the motors to work improperly?

Why do you think pin 13 might not be suitable?

...R

palashrc0945:
My question is that what all pins I can use? Can i use the pins 22 to 53 in the same way i use the pins 2 to 12? is there any difference between these two different set of pins (2 to 12 and 22 to 53)?

I think, in your case, you can use the pins freely for your purpose but, technically, you are right. The rows are not the same, and the end ones are not even the same as each other. I understand pulse width modulation is available on all the pins 2-13 on the side but only pins 44,45,46 on the end, and pins 50>53 are available for the SPI bus, which is not available on the side.

Sorry for replying after a long time. But i was working on this project of mine and i succeeded. Really happy for it. and i am using Arduino Mega 2560 only.

Here is the link for the video of my project

I want to thank everyone for your help and support.

Very nice :wink:

Thank you.