Search code examples
luaesp8266nodemcu

How to recover nodemcu infinite loop


I made a mistake loading init.lua with a infinite loop on my nodemcu/ESP8266 board.

Then the board keep rebooting without any other instruction executed.

i = 10
timerId = 0
timerDelay = 30000 -- Milisec
pin = 5
gpio.mode(pin,gpio.INPUT) 
repeat(    
    print(gpio.read(pin))
    i = i + 1
    end)
until i < 5

Solution

  • I tried flashing the board

    python esptool.py -p /dev/tty.wchusbserial1450 run
    
    python esptool.py -p /dev/tty.wchusbserial1450 write_flash 0x0000 ../nodemcu_latest.bin
    

    And after that fix my code and load it again and now works fine