While writing GPIO code on NodeMCU, you can’t address them with actual GPIO Pin Numbers. There are different I/O Index numbers assigned to each GPIO Pin which is used for GPIO Pin addressing. Refer following table to check I/O Index of NodeMCU GPIO Pins –
GPIO Pin | I/O Index Number |
GPIO0 | 3 |
GPIO1 | 10 |
GPIO2 | 4 |
GPIO3 | 9 |
GPIO4 | 2 |
GPIO5 | 1 |
GPIO6 | N/A |
GPIO7 | N/A |
GPIO8 | N/A |
GPIO9 | 11 |
GPIO10 | 12 |
GPIO11 | N/A |
GPIO12 | 6 |
GPIO13 | 7 |
GPIO14 | 5 |
GPIO15 | 8 |
GPIO16 | 0 |
Stolen from: