Pages: [1]   Go Down
Author Topic: AnalogIn to DigitalIn  (Read 754 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

UK
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2883
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Analogue pin zero is digital pin 14, analogue pin 1 is digital 15, and so on.
Logged

Per Arduino ad Astra

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

UK
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2883
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
pinMode (14, INPUT);
« Last Edit: May 10, 2010, 08:52:34 am by GrooveFlotilla » Logged

Per Arduino ad Astra

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I will give it a try.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 146
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so on the mega

analog pin 0 is digital read 54?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 146
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes it Works fine
Logged

Pages: [1]   Go Up
Jump to: