2

http://arduino.cc/en/Reference/pinMode notes that

The analog input pins can be used as digital pins, referred to as A0, A1, etc.

Is it possible to configure these pins as digital output pins as well?

1 Answer 1

2

Yes.

http://arduino.cc/en/Tutorial/AnalogInputPins states

The analog pins can be used identically to the digital pins, using the aliases A0 (for analog input 0), A1, etc. For example, the code would look like this to set analog pin 0 to an output, and to set it HIGH:

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

There are several caveats on that page regarding this.

4
  • Good clear answer and very informative link. (voted)
    – Duncan C
    Sep 1, 2014 at 11:21
  • Wait. You answered your own question? Was this a teaching post, or did you find the answer through research after posting your question?
    – Duncan C
    Sep 1, 2014 at 11:25
  • A combination. I had thought I heard it was the case, but the pinMode documentation wasn't clear. When I found the AnalogInputPins page I thought it would be nice to tie those together. Sep 1, 2014 at 18:49
  • 1
    One more detail: the ATMega 328P in some packages (not including DIP) can support A6 and A7 analog inputs. While the UNO does not provide pinouts for these (ie: they are unconnected), many clone Arduino Pro Mini boards do. And these two pins are Analog Inputs only, no Digital I/O functionality. The other Analog Input pins are as you note also digital I/O compatible.
    – Zeph
    Feb 26, 2016 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.