If you are using a NodeMCU firmware on you ESP take note on the GPIO table mapping. All access is based on the I/O index number on the NodeMCU dev kits, not the internal GPIO pin.
ESP8266 NodeMCU board from LoLin
This is a ESP8266 NodeMCU board from LoLin.