Need some help understanding basic pinout of GPIO.

I'm looking at the pinout of the Wemos D1 Mini Pro:

I'm a beginner and working through the basic Arduino examples. So far I've been introduced to analog, digital, pwm, tx, and rx pins.

  • There are a lot of missing GPIO numbers. GPIO1, GPIO3, 7, 8, 9, etc for example, don't exist on the pinout list. What's going on? Are they being used internally by the chip (ie. not exposed to the outside?).

  • Why doesn't the numbering match between the D-pins and GPIO pins? For example, Pin D0 is used for IO but it's GPIO16. Huh? In the Arduino code you would normally just do:

int sensor1 = D0;

I'm guessing that on the physical ESP8266EX chip, the pin that's called "GPIO16" is connected to the pin that's labeled "D0" on the circuit board? Is that all it means? Would there ever be a time you would need to specify "GPIO16" in your code?

  • On the color-coded photo of the chip at the bottom, NodeMCU is in grey. I haven't gotten into NodeMCU yet, but my understanding is that NodeMCU is a platform totally separate from Arduino, right? The stock firmware on the Wemos uses Arduino and C++. The Wemos supports uploading a NodeMCU firmware which would then turn it into a NodeMCU device, necessitating programming in Lua, using Lua libraries, etc, right? If I'm coding in Arduino for now I can just ignore anything that has to do with NodeMCU.

The NodeMCU people, for reasons I will never understand, renumbered the pins on their NodeMCU board, and since than many people have maintained their stupid convention.

TX and RX are GPIO 1 and 3.

GPIO 6~11 are used to access the flash memory chip.

So in the image that I posted, the stuff under the "Pin" column (TX, RX, A0, etc), are those the "aliases" that I would use in my Arduino code?

For example, int sensor1Pin = D4;

Are you saying that in Lua / NodeMCU the equivalent code would instead be (in psuedo Lua code): int sensor1Pin = GPIO2;

Another thing that kind of puzzles me is that the Arduino appears to not require "Dx" in its code. For example, analog pin #5 is coded with int analogSensor = A5;

But digital pin #5 is simply coded with int digitalSensor = 5;

On the Wemos, however, digital pin #5 is done with int digitalSensor = D5;

I guess this is simply a different alias convention between the two chips?