9

In ESP-12E NodeMCU, all digital pins can be called with a number. Here is the list:

static const uint8_t D0   = 16; 
static const uint8_t D1   = 5;
static const uint8_t D2   = 4;
static const uint8_t D3   = 0;
static const uint8_t D4   = 2; 
static const uint8_t D5   = 14;
static const uint8_t D6   = 12;
static const uint8_t D7   = 13;
static const uint8_t D8   = 15;
static const uint8_t D9   = 3;
static const uint8_t D10  = 1;

So these two lines of code will do the same:

pinMode (D0, INPUT)
pinMode (16, INPUT)

What's the corresponding number for A0 (the only analog input of this board)?

mmv-ru
  • 113
  • 5
pfernandez
  • 201
  • 1
  • 2
  • 4

1 Answers1

8

The numeric value of A0 is 17, as defined here.

But unlike on an Arduino board, you can't use it as a digital pin. It only work for pin numbers 0-16.

If you are using as a parameter for analogRead, the numeric values would be 0 and 17, as seen here.

And as such, these three calls would do the same:

analogRead(A0);
analogRead(17);
analogRead(0);
gre_gor
  • 1,682
  • 4
  • 18
  • 28