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?

asked Sep 1, 2014 at 8:27

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.

answered Sep 1, 2014 at 8:34
4
  • Good clear answer and very informative link. (voted) Commented 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? Commented 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. Commented 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. Commented Feb 26, 2016 at 6:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.