Interrupt NodeMCU init.lua
It can be sometimes challenging to regain control of the NodeMCU running on a ESP8266 when init.lua has a tight loop in it. To do so, first, download esptool.py from GitHub.
Execute the following command
python esptool.py --port /dev/ttyUSB0 --baud <baud-rate> erase_flash
where
<baud-rate> is the baud rate of the connection between the ESP8266 and your PC. Typically, 9600.
<serial-port> is the serial port the ESP8266 is connected to. Typically, /dev/ttyUSBn on Linux.
After having done this, you will need to re-install NodeMCU. It can be done using the following command:
python esptool.py --port /dev/ttyUSB0 --baud <baud-rate> write_flash 0x00000 <nodemcu-path>
where
<baud-rate> is the baud rate of the connection between the ESP8266 and your PC. Typically, 9600.
<serial-port> is the serial port the ESP8266 is connected to. Typically, /dev/ttyUSBn on Linux.
<nodemcu-path> is the filename an path of the NodeMCU image. Example: ../nodemcu_float_0.9.6-dev_20150704.bin