Skip to main content
1 of 3
Craig
  • 2.1k
  • 10
  • 11

Yes, the analog pins must be addressed using A0, A1,...

Depending on the board you are using A0,A1,etc. are mapped to different values (for instance it looks like A0 is 18 on some boards but 14 on others.

One solution for looping over the analog pins would be this:

static const uint8_t analog_pins[] = {A0,A1,A2,A3,A4};

for (int i = 0; i < 4; i++) {
  analogRead(analog_pins[i]);
}
Craig
  • 2.1k
  • 10
  • 11