Chat about current Lua tools and IDEs

User avatar
By Gregsta
#47166 I've been trying to make ESPlorer work with my NodeMCU but none of the Lua examples seem to work. Here's what I have tried so far:

- flashed the latest firmware and got errors in the IDE saying there's no init.lua
- flashed the previous firmware and the board is now recognised by ESplorer (baud rate 9600)
- commands and snippets work fine but I cannot turn on or off any of the GPIOs
- when saving a script to the ESP, I get errors. Here's the blink example and the error:

Code: Select allpin=16
lighton=0

gpio.mode(pin,gpio.OUTPUT)

tmr.alarm(1,1000,1,function()
    if lighton==0 then
        lighton=1
        gpio.write(pin,gpio.HIGH)
   else
        lighton=0
        gpio.write(pin,gpio.LOW)
   end
  end)


file.close();
dofile("blink2.lua");
stdin:2: '<name>' expected near '='


What am I doing wrong? Thank you for you help in advance!
User avatar
By dnc40085
#47230 The pin number you are trying to use is invalid, you can find the pin map here.
If possible you should use a different gpio. Typically gpio16 is connected to the reset pin to enable use of the deep sleep function(node.dsleep())

Other than that, your code seems correct.
User avatar
By Gregsta
#47235
dnc40085 wrote:The pin number you are trying to use is invalid, you can find the pin map here.
If possible you should use a different gpio. Typically gpio16 is connected to the reset pin to enable use of the deep sleep function(node.dsleep())

Other than that, your code seems correct.


I did try to manually flip the GPIOs on and off and nothing happened. Something is not write with either the firmware or ESPlorer.
User avatar
By dnc40085
#47268 ESPlorer is just a glorified serial terminal, so it shouldn't be contributing to the problem.

Are you using the right pin number? (ex. gpio4=2 gpio.write(gpio4, gpio.HIGH)) if yes, then...
Have you tried a current build of the dev branch from nodemcu-build.com (Note: dev branch uses 115200 baud rate)?