Possibly a dumb Q about input pins.

Howdy,

I ca't figure out if the analoge input pins are somehow mapped to the digital pins.

If I want to use pin 2 (top row) as a digital output and pin 2 (bottom row) as an analogue input at the same time is this possible?

Cheers.

The Arduino pin numbers corresponding to the analog pins A0 through A5 are also known as digital pins D14 through D19. The analog pins can be used identically to the digital pins, so for example, the code would look like this to set analog pin 0 to an output, and to set it HIGH:

pinMode(14, OUTPUT);
digitalWrite(14, HIGH);

Yes, you can use both digital pin 2 and analog input 2.

Arduino recognizes the difference even though they both have the same number. analogRead() will use analog input pins, while digitalRead() or digitalWrite() will use digital pins.

Note that you don't have to set the pinMode() for the analog input pins.

See the tutorials for good examples of using either. There's no problem combining them.

The confusion comes from also being able to use the pins labeled as analog inputs as digital pins, but only if you don't want to use them as analog pins. Sort of a thing to move up to after you're a little experienced.