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
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.
-
Good clear answer and very informative link. (voted)Duncan C– Duncan C09/01/2014 11:21:50Commented 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– Duncan C09/01/2014 11:25:08Commented 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.Mark Harrison– Mark Harrison09/01/2014 18:49:51Commented Sep 1, 2014 at 18:49
-
1One 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– Zeph02/26/2016 06:31:28Commented Feb 26, 2016 at 6:31