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

asked Feb 1, 2017 at 17:23
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);
answered Feb 1, 2017 at 17:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.