Hello, this is my second Instructable so please bear with me.
I am going to tell you how to get 6 extra Arduino digital pins.
I discovered this by playing with the Arduino IDE and tried setting up a LED on pin 14 (which does not exist on the board) And guess what? Analog pin 0 is pin 14!

Step 1: How to Get the Other Analog Inputs Working Too

It is pretty simple to get the others working too! Here is a list of all of the pins:

Pin 14 = Analog in 0
Pin 15 = Analog in 1
Pin 16 = Analog in 2
Pin 17 = Analog in 3
Pin 18 = Analog in 4
Pin 19 = Analog in 5

Unfortunately these are not PWM pins, but you can use the SoftPWM library to get software-based PWM, which is almost as good as native PWM.
<p>This must be one of the most stupid instructables I&acute;ve ever encountered.</p><p>First of all you don&acute;t add any extra pins... correct title would be &quot;how to use the analog pins as digital on your Arduino&quot;. </p><p>second this is a STANDARD arduino feature and can documentation can be found on the Arduino site ( <a href="https://www.arduino.cc/en/Tutorial/AnalogInputPins" rel="nofollow">https://www.arduino.cc/en/Tutorial/AnalogInputPins...</a> )</p><p>And to set, for example, analog 0 as output and high you just can use</p><p> pinMode(A0, OUTPUT); </p><p>digitalWrite(A0, HIGH);</p><p>(Note that even have to figure out the pin number, the A[n] aliases just work )</p><p>And finally, one should NOT drive leds without current limiting resistors on any Arduino output. The Atmel controlers are not designed for that and multiple leds connected this way can destroy your microcontroler.</p><p>Ahhh and as bonus.... it&acute;s also pretty braindead to use a second output as ground as done in this example</p>
<p>I agree...Its misleading to say the least.</p>
<p>Can you program an analog input channel into an analog output channel?</p>
<p>Thanks, I was running out of digital pins.</p>
<p>what if i want to give two different inputs to pin 0 and 1?</p>
<p>Will this work for bluetooth hc 05 if I give tx rx to any two analog pins using the digital function.I am using serial I cannot use pin 0 and 1 as it creates conflict(which I myself didn't really understand).i need to control servos using bluetooth app.</p>
<p>Thank you, I was getting some problems trying to use the analog 0 and 1 pins for reading a digital sensor, now works just fine.</p>
Its nothing new, Its already on the board &gt;_&lt;<br />
<p>I actually found this instructable by Googling for the answer to <a href="https://www.sparkfun.com/products/11114#comment-53bb5635757b7f804f8b4569" rel="nofollow">my question I asked over on Sparkfun</a>. So, I for one appreciate the time he spent making this. I'm new to hardware and EE. There is so much mystery in it (especially the Arduino) for me.</p>
<p>There is not many mystery in Arduino -_- study microcontrollers.These are all same</p>
<p>That's pretty arrogant. There is plenty of mystery. There are numerous resources dedicated to it. This happens to be one of them. The whole point of Arduino is to make microcontrollers approachable to the people who learn by doing. Finally, they are not all the same. They are subtly different and therein lies the mystery.</p><p>There was just nothing good or true in your comment. Why do people feel the need to leave comments like this? &quot;Look, a person on the internet does not know something that I know. -_- Grr, that makes me angry. I must strike them down.&quot;</p>
<p>I second that. Learning Arduino (and it's programming) is not that easy if you're a noob. It might be kiddy stuff for those who knows their way around more advanced electronics, but for people who'd never tinkered with this before, no.</p>
<p>Actually Instructables is usually one of the better sites as far as not having comments from the electronics equivalent of the Comic Book Guy from the Simpsons. Unfortunately a couple of them squeeze through...</p>
<p>Also works with the nano.</p>
<p>For Arduino Mega, analog pin's digital number is as:</p><p>A0 = 54<br>A1 = 55<br>A2 = 56<br>A3 = 57<br>A4 = 58<br>A5 = 59<br>A6 = 60<br>A7 = 61<br>A8 = 62<br>A9 = 63<br>A10 = 64<br>A11 = 65<br>A12 = 66<br>A13 = 67<br>A14 = 68<br>A15 = 69</p>
<p>I'd like to point out that with the SparkFun Arduino Pro Micro it is:</p><p>A0 = D18</p><p>A1 = D19</p><p>A2 = D20</p><p>A3 = D21</p><p>For the Leonardo also gain:</p><p>A4 = D22</p><p>A5 = D23</p><p>A6 = D24</p><p>A7 = D25</p><p>A8 = D26</p><p>A9 = D27</p><p>A10 = D28</p><p>A11 = D29</p>
<p>Hello <a href="/member/RichardBronosky">RichardBronosky</a> can you give an example on how to do a simple code to read A1 Pin as a Digital pin?</p><p>Thank You.</p><p>I did this, but is not working.</p><p>void setup()</p><p>{</p><p> Serial.begin(9600);</p><p> pinMode (A1, INPUT); </p><p>} </p><p>int DIGITAL;</p><p>void loop()</p><p>{</p><p> DIGITAL = digitalRead(A1);</p><p> Serial.print(DIGITAL);</p><p> delay(500); </p><p>}</p>
<p>dont define it as A1 but as D15</p>
<p>Thank you, this just answered a question I was asking in regard to the arduino pro-mini, normally only 14 digital outputs and I need 16, seems this solves it for me, cheers!</p>
<p>You can use 4 additional digital pins in Arduino Micro:</p><p>MISO = D14</p><p>SCK = D15</p><p>MOSI = D16</p><p>SS = D17 (orange LED conneted on board)</p>
<p>Thanks so much you solve a big problem faced me</p>
<p>If anyone would like more output pins, you could utilise a demultiplexer. See following:</p><p>http://en.wikipedia.org/wiki/Multiplexer</p><p>http://www.ebay.com.au/itm/10-pcs-CD4051BE-CD4051-4051-IC-16-pins-CMOS-Multiplexer-Switches-Demultiplexer-/371116027139?pt=LH_DefaultDomain_15&amp;hash=item56683d2d03</p><p>http://pdf1.alldatasheet.com/datasheet-pdf/view/26882/TI/CD4051BE.html</p>
<p>Adding shift registers is also a inexpensive and easy option.</p>
<p>Fantastic!! I was trying to find out if I could sub the analogs for digitals. strangely I had no success in finding a straight forward answer and thus wrote it off, and now stumbled on this while looking for something else HAHA. This saves me from having to incorporate another board. Thanks a bunch for sharing. any idea how one might get them to chase like Christmas lights for a time period as a sub routine to a sketch?</p>
Thanks for sharing, I knew you could control the pull up of an analog but didn't know it also had a digital pin number too.
<p>Same here. The fact that analog pins can be used as digital is well documented. I was a bit annoyed by the title at first, but this is good info.</p>
<p>awesome just what i needed, more pins.</p>
<p>I am Brazilian student. thanks for the help always has excellent tutorials</p>
Thanks! <br>btw, in SoftPWM, you can write it as pin A1 and it works just as well as pin 15.
Good info thanks !
thanks for the information.....as all know that &quot;analog pin can be use as digital&quot; is already on arduino.cc....... but helpful info. is that A0 is pin 14...that is not given on site... :)<br>
On the MEGA the anlog pins are digital&nbsp; 53,54,55 etc.<br />
It's new to me!&nbsp;&nbsp;Thanks for sharing!&nbsp; I know this will come in handy!<br />
it's also on this page:&nbsp; <cite>www.<b>arduino</b>.cc/en/Guide/Board&nbsp; whereit says :<br /> </cite>&quot;&nbsp;Most of the <em>analog</em> inputs can also be used as <em>digital pins &quot;</em><br />
News to me - thanks for the tip!<br />
neat, but what about the arduino MEGA's?<br /> they have digital pins up to 53 and analog pins upto 16<br />
&nbsp;It's already in the arduino documentation but it's a bit hidden:<br />http://arduino.cc/en/Reference/PinMode<br />(watch the note at the end of the page...)
Yeah, this is pretty well known.
that's pretty cool and is very helpful. Thanks!

About This Instructable



Bio: I'm a software developer, but I also love tinkering with electronics. My Instructables are all about Arduino.
More by baharini:ATTiny45/85 LCD display control with a shift register, programmed in Arduino Controlling a character LCD with an Arduino How to add 6 extra pins to your Arduino with no extra hardware 
Add instructable to: