nodemcu is a wonderful piece of code but it don’t work well on my ESP-01, it will go into a boot loop with just a few lines of code. Initially I though it was my mistake but it does that even with published examples.
Moving on, I took a bit of time to set up esp-open-sdk and started to work on what I think will be a base for my future ESP8266 projectts.
My basic code is based on tuanpm’s native mqtt library and stdout which reclaims the RX pin for use as GPIO3.
The code basically logs on to my wifi AP then to the MQTT broker (mosquitto) on my server. By default, I can control a LED connected to GPIO2 by publishing a 1 or 0 to the topic subscribed by the ESP-01 and read a switch on GPIO0. RX/GPIO3 can be configure for other use.
Code available on my Github repository.