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)?

0

1 Answer 1

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.