![Handson Technology ESP8266 WiFi Manual Download Page 22](http://html1.mh-extra.com/html/handson-technology/esp8266-wifi/esp8266-wifi_manual_3556998022.webp)
6.
NodeMCU GPIO for Lua
The GPIO(General Purpose Input/Output) allows us to access to pins of ESP8266 , all the pins of ESP8266 accessed
using the command GPIO, all the access is based on the I/O index number on the NoddMCU dev kits, not the internal
GPIO pin, for example, the pin ‘D7’ on the NodeMCU dev kit is mapped to the internal GPIO pin 13, if you want to
turn ‘High’ or ‘Low’ that particular pin you need to called the pin number ‘7’, not the internal GPIO of the pin. When
you are programming with generic ESP8266 this confusion will arise which pin needs to be called during
programming, if you are using NodeMCU devkit, it has come prepared for working with Lua interpreter which can
easily program by looking the pin names associated on the Lua board. If you are using generic ESP8266 device or any
other vendor boards please refer to the table below to know which IO index is associated to the internal GPIO of
ESP8266.
Nodemcu
dev kit
ESP8266 Pin
Nodemcu dev
kit
ESP8266 Pin
D0
GPIO16
D7
GPIO13
D1
GPIO5
D8
GPIO15
D2
GPIO4
D9
GPIO3
D3
GPIO0
D10
GPIO1
D4
GPIO2
D11
GPIO9
D5
GPIO14
D12
GPIO10
D6
GPIO12
D0 or GPIO16 can be used only as a read and write pin, no other options like PWM/I2C are supported by
this pin.
In our example in chapter 5 on blinking the blue LED, the blue LED in connected to GPIO2, it is defined as
Pin4 (D4) in Lua script.
7.
Web Resources:
•
ESP8266 Lua Nodemcu WIFI Module
•
ESP8266 Breadboard Friendly Module
•
ESP8266 Remote Serial WIFI Module
•
PL2303HX USB-UART Converter Cable
22