Analog input as digital I/O

Hi all. I've been using the arduino since december, and have to say I am well pleased. So far I've made: a binary clock, LCDSmartie device, a mood light and am currently working on a weather station (temp indoor/outdoor, humidity, pressure, LCD and SD logging).

The only problem is, I've run out out digital I/O's, but still have one analog input left.

I've heard it intemated in a few places that an analog pin can be used for digital I/O, but cant for the life of me find any reference on how to do it.

It's strange, because I've managed to go from no electronics experience to being able to do all the above stuff without ever having to ask a question as there is so much good info out there that I haven't needed to.

So, can anyone tell me, is it possible to do this from the Arduino IDE?
Can I turn just one analog pin over to digital, or is it all or nothing?

Many thanks for any replies in advance, and to all in the Arduino team and all that post such helpful info and libraries - Keep up the good work!!!!!

Regards,
The Cageybee :slight_smile:

pins 14..19 for a 2009 board.

hmm. A little scant on details, but thanks for the reply anyway. I think I get it. :-/

Just to clarify, I take it that this would work for analog pin 0 to set it as a digital out:-

void setup(){
pinMode(14, OUTPUT);
}

Cheers,
The Cageybee

Bingo!

Many thanks!!!!!!!! :slight_smile:

The Cageybee