If you are getting fatal error exception like this:
epc1=0x401003e9 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4000cbd9 depc=0x00000000
In infinite loop in your Serial Monitor of the Arduino IDE then go to this link, download the software, and follow the procedure and erase the flash memory to solve the error.
This does not solve fatal error that occurs due to your program but in case your device goes in such condition that it can't be able to access program memory then it will work and try at least one time to solve the problem.
This is the procedure to hard reset the NodeMCU (https://www.youtube.com/watch?v=MHrm7axsImI&t=146s):
- Install latest Python version in your PC. (https://www.python.org/downloads)
- Open cmd prompt as administrator.
- Go to C:\Program Files or C:\Program Files (x86)->python (your version)->Script. For this type
cd c:\Program Files (x86)\python(your version)\Script then press enter.
pip install esptool.
- Download ESPlorer.zip (v 0.2.0-rc6) from https://esp8266.ru/esplorer
- Extract the downloaded file.
- Open the executable jar file.
- Go to NodeMcu firmware site (https://github.com/nodemcu/nodemcu-firmware/releases) and download file (nodemcu_float_0.9.6-dev_20150704.bin) and copy this file into the C:\Program Files (x86)/python(your version)/Script folder.
Now in cmd prompt just type:
esptool.py --port COM(your port no.) --baud 115200 erase_flash
And press enter.
Note: you can see your NodeMCU board's port number in Device Manager .