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. For example, the D0 pin on the dev kit is mapped to the internal GPIO pin 16.
gpio.mode(0, gpio.OUTPUT)
For Olimex ESP8266 EVB board you can use the folowing definitions
–define GPIO pins
GPIO0 = 3
GPIO1 = 10
GPIO2 = 4
GPIO3 = 9
GPIO4 = 2
GPIO5 = 1
GPIO9 = 11
GPIO10 = 12
GPIO12 = 6
GPIO13 = 7
GPIO14 = 5
GPIO15 = 8
GPIO16 = 0
Note the the GPIO pins are available on the UEXT connector and on the CON3
ESP8266 NodeMCU pins GPIO