Ref. Doc. analogRead(3) or/and analogRead(A3)

What is the correct syntax

analogRead(3)

or

analogRead(A3)

or both is correct ?

In the Reference section, in the analogRead() page, there is an exemple containing:

int analogPin = 3; // potentiometer wiper (middle terminal) connected to analog pin 3
...
val = analogRead(analogPin); // read the input pin

In the Learning section, in the Analog Input Pins, there is an exemple containing:

pinMode(A0, OUTPUT);

Could there be a little sentence in the analogRead() page telling how you name a pin: 3 or A3 or both?

If you want to use an analog pin as a digital pin then A3 is the only correct answer:

pinMode(A3, OUTPUT);  // Set Analog Input 3 as a digital output
digitalWrite(A3, HIGH);  // Set the Analog Input 3 to HIGH

pinMode(3, OUTPUT);  // Set Digital pin 3 as an output
digitalWrite(3, HIGH);  // Set Digital pin 3 to HIGH

For analogRead() you can use 3 or A3 but it is easier to understand if you use A3.

Thank you. :slight_smile: