Mega analog / digital pin mapping

Sorry if this is a dumb question, but... :slight_smile: I have a Mega which has 16 analog pins (0-15) and 54 digital pins (0-53). Since analog pin 0 and digital pin 0 are different animals, I guess this means that analogRead() uses a different pin mapping than digitalRead()/digitalWrite(). Is this correct?

If so, how can I use the analog pins for digitalRead()/digitalWrite()? I'd like to enable pullups on my analog pins to be able to detect presence of a sensor. The documentation at says to use digitalWrite(PIN, HIGH), but if I use digitalWrite(0, HIGH), won't this just end up setting digital pin 0 as high and not touch analog pin 0?

try this thread:-


Beautiful!! This post by mem answered my question:

Shouldn't this be somewhere on the Mega page or in the documentation?

Thank you very much!