Go Down

Topic: Mega 2560 digital pin number of the analog pins (Read 2020 times) previous topic - next topic

tomroth

Hi all!

Does anyone know what the digital equivalent of analog pins 0-15 on a Mega 2560 is? I need some more digital pins and I know that on the Uno, analog pins 0-5 are digital 14-19. So is there something similar on the Mega?

Thanks!

retrolefty


Hi all!

Does anyone know what the digital equivalent of analog pins 0-15 on a Mega 2560 is? I need some more digital pins and I know that on the Uno, analog pins 0-5 are digital 14-19. So is there something similar on the Mega?

Thanks!


You do know that you can just use the analog pin name in a digital statement, as in
digitalWrite(A0, HIGH); pinMode(A0, OUTPUT); That works for both a Uno and Mega board without having to remember what the digital pin name is for the same physical pin.

But if you do want the digial alias name for the analog pin numbers then this doc should help. Arduino digital pin names are is the far left column.

https://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0

Lefty

mordub

are you saying that for example if Im using digital pin 5 and also analog pin 5 I can just say : pinMode(A5,INPUT); pinMode(5,OUTPUT);
this would be great. also one way to find out whats the equivalent digital pin for an analog pin is for example on mega we have 53 digital pins so analog pin 0 is 54,  just add whatever pin number to 53. and on uno we have 13 digital pins so analog 0 is 14..

Go Up