Instructables

How to add 6 extra pins to your Arduino with no extra hardware

Picture of How to add 6 extra pins to your Arduino with no extra hardware
arduino blink.gif
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!
 
Remove these adsRemove these ads by Signing Up

Step 1: How to get the other analog inputs working too

Picture of 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.

Step 2: The example code

Here is just an example code i wrote for testing:

int ledPin = 14;
int gndPin = 15;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(gndPin, OUTPUT);

digitalWrite(gndPin, LOW);
}

void loop()
{
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}

GR0B6 months ago
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.
Nickson Yap7 months ago
Thanks!
btw, in SoftPWM, you can write it as pin A1 and it works just as well as pin 15.
oqla20002 years ago
Good info thanks !
'jaiswal2 years ago
thanks for the information.....as all know that "analog pin can be use as digital" is already on arduino.cc....... but helpful info. is that A0 is pin 14...that is not given on site... :)
neutron74 years ago
On the MEGA the anlog pins are digital  53,54,55 etc.
Grathio4 years ago
It's new to me!  Thanks for sharing!  I know this will come in handy!
ReCreate4 years ago
Its nothing new, Its already on the board >_<
davidbuzz4 years ago
it's also on this page:  www.arduino.cc/en/Guide/Board  whereit says :
" Most of the analog inputs can also be used as digital pins "
belectric234 years ago
News to me - thanks for the tip!
neat, but what about the arduino MEGA's?
they have digital pins up to 53 and analog pins upto 16
Dege4 years ago
 It's already in the arduino documentation but it's a bit hidden:
http://arduino.cc/en/Reference/PinMode
(watch the note at the end of the page...)
Noodle934 years ago
Yeah, this is pretty well known.
ikestarm174 years ago
that's pretty cool and is very helpful. Thanks!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!