Go Down

Topic: AnalogIn to DigitalIn (Read 1 time) previous topic - next topic


Is it possible to turn an analog IN port to digital IN port ?
I need 2 more digital IN for 2 push buttons but I run out of digital ports...

Please help...


Analogue pin zero is digital pin 14, analogue pin 1 is digital 15, and so on.
Per Arduino ad Astra


Sorry but I didn't understand.
I am using Arduino Duemilanove with 14 digital IN/OUT and 6 analog IN/OUT. Correct ?
All my digital pins are taken so I need a way to turn an analog pin to digital in order to use it for a push button.

I am quite new to arduino so please help...


May 10, 2010, 03:51 pm Last Edit: May 10, 2010, 03:52 pm by GrooveFlotilla Reason: 1
When you use the digital pins, you specify, say, a pin number 0 to 13, yes?
When you want to use an analogue pin as a digital pin, you use the analogue pin number plus 14.

So, to set analogue pin zero as a digital input,
Code: [Select]
pinMode (14, INPUT);
Per Arduino ad Astra


I think I understand now.
Thanks a lot...

I will give it a try.


so on the mega

analog pin 0 is digital read 54?


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131