Go Down

Topic: Differentiate between A3 and D3 in code (Read 1 time) previous topic - next topic

icecool2

This might be a stupid question, but I can't seem to find the answer.

I have a Pro-Mini 16MHz from Sparkfun.  I'd like to use all of the pins, but I'm confused about how I would define the use of both the A3 and D3 pins.  I know I can't just say pin 3 right?

For example:

I can do analogRead(3) and that's A3 right?  Can't I also do digitalRead(3) and that be D3?

retrolefty

Quote
I can do analogRead(3) and that's A3 right?  Can't I also do digitalRead(3) and that be D3?


Yes, that is correct the analogread and digitalread functions know which pin 3 to use, A3 or D3 respectively.

Lefty


icecool2

OK, that part make sense.  But what if I want to use A3 as a digital IO pin?

retrolefty

Then you use the following from the Arduion reference section:

"The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5). "

so using:

pinMode(17, INPUT);
val = digitalRead(17);

Will allow the A3 pin to be used as a digital input pin.

Lefty

icecool2

Sweetness.  Thanks a bunch.  What section was that under?

retrolefty

http://arduino.cc/en/Reference/DigitalRead

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!

Arduino
via Egeo 16
Torino, 10131
Italy