arduino / reference-en

Editable source for the Arduino Reference
https://www.arduino.cc/reference/en/
Other
165 stars 732 forks source link

Reference missing mention of constants A0, A1, ... #785

Open NeatNit opened 7 years ago

NeatNit commented 7 years ago

As I mentioned along with some other stuff on the forum, the analog input pin constants are not mentioned in the Arduino reference - not under Constants and not in analogRead.

But actually, I'm unclear on how they are used. I have an Uno and the constant A0 has the value 14. The example AnalogReadSerial uses this constant to read the value: int sensorValue = analogRead(A0); However, the analogRead reference page says:

pin: the number of the analog input pin to read from (0 to 5 on most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega)

So which is it? Is the reference page plain wrong, or are A0 and 0 equivalent for analogRead?

matthijskooijman commented 7 years ago

analogRead supports two argument values: The analog channel number (0-something), or the pin number (e.g. 14+ on a Uno) that can also be passed to digitalWrite. Does that clarify?

NeatNit commented 7 years ago

Yes, thank you... though pert has already clarified this on the forum.

per1234 commented 4 years ago

not in analogRead.

This issue was fixed by https://github.com/arduino/reference-en/pull/463

the analog input pin constants are not mentioned in the Arduino reference - not under Constants

This issue remains.