So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By jwmeyer
#63544 It works on my Linux with esplorer v0.20-RC2. Here is the log from when I use the save button on the "Scripts" menu with AutoSave file to ESP after save to disk selected in settings:
Code: Select allWe save known file script1.lua
Try to saving file script1.lua ...
Save file script1.lua: Success.
FileSaveESP: Try to save file to ESP...
DataSender: start "Smart Mode"
FileSaveESP: Starting...
sending:file.remove("script1.lua");<CR><LF>
recv:file.remove
recv:("script1.lua");<CR><LF>
recv:>
recv:
sending:file.open("script1.lua","w+");<CR><LF>
recv:file.op
recv:en("script1.lua","w+");<CR><LF>
sending:w = file.writeline<CR><LF>
recv:>
recv:w = file.writeline
sending:w([[timerId = 0]]);<CR><LF>
recv:w([[timer
recv:Id = 0]]);<CR><LF>
recv:>
sending:w([[dly = 1000]]);<CR><LF>
recv:w([[dly = 1000]]
recv:);
sending:w([[-- use D4]]);<CR><LF>
recv:w([[-- use D
recv:4]]);<CR><LF>
recv:>
sending:w([[ledPin = 4]]);<CR><LF>
recv:w([[ledPin = 4]]);

recv:
>
sending:w([[-- set mode to output]]);<CR><LF>
recv:w([[-- set mode to output]]);<CR><LF>
recv:>
sending:w([[gpio.mode(ledPin,gpio.OUTPUT)]]);<CR><LF>
recv:w([[gpio.mod
recv:e(ledPin,gpio.OUTPUT)]]);<CR><LF>
recv:>
sending:w([[ledState = 0]]);<CR><LF>
recv:w([[ledState
recv: = 0]]);<CR><LF>
recv:>
sending:w([[-- timer loop]]);<CR><LF>
recv:w([[-- timer lo
recv:op]]);
sending:w([[tmr.alarm( timerId, dly, 1, function()]]);<CR><LF>
recv:w([[tmr.alarm( timerId
recv:, dly, 1, function()]]);<CR><LF>
recv:>
sending:w([[ledState = 1 - ledState;]]);<CR><LF>
recv:w([[l
recv:edState = 1 - ledState;]]);<CR><LF>
recv:>
sending:w([[-- write state to D4]]);<CR><LF>
recv:w([[-- write s
recv:tate to D4]]);<CR><LF>
recv:>
sending:w([[gpio.write(ledPin, ledState)]]);<CR><LF>
recv:w([[
recv:gpio.write(ledPin, ledState)]]);<CR><LF>
recv:>
sending:w([[end) ]]);<CR><LF>
recv:w([[end) ]]);
recv:<CR><LF>
recv:>
sending:file.close();<CR><LF>
recv:file.clos
recv:e();<CR><LF>
recv:>
sending:dofile("script1.lua");<CR><LF>
recv:dofi
recv:le("script1.lua");<CR><LF>
Operation done. Duration = 821 ms


As you can see it just writes each line to the file on the ESP and then runs the file. My blue light starts to blink.
I can't guess what the problem is since I don't use the windows version.
User avatar
By yamhill
#63550 You're show more detail than I see. Here's what I'm getting.

Still using ESPlorer v0.2.0-rc5 per the help page, but the release file says: ESPlorer v0.2.0-rc6

Here's what happens when I try to "Save to ESP". Notice that it seems to drop some lines.
> file.remove("ledtry2.lua");
> file.open("ledtry2.lua","w+");
> ([==[-- timer loop]==]);
w([==[tmr.alarm( timerId, dly, 1, function()]==]);
w([==[ ledState = 1 - ledState;]==]);
w([==[ -- write state to D4]==]);
w([==[ gpio.write(ledPin, ledState)]==]);
w([==[end) ]==]);
file.close();
dofile("ledtry2.lua");
stdin:1: syntax error near ';'
>


Here's what happens with "Send to ESP": All is happy and the led is blinking.
> timerId = 0
> dly = 1000
> -- use D4
> ledPin = 4
> -- set mode to output
> gpio.mode(ledPin,gpio.OUTPUT)
> ledState = 0
-- ti> mer loop
stdin:1: '=' expected near 'loop'
> tmr.alarm( timerId, dly, 1, function()
>> ledState = 1 - ledState;
>> -- write state to D4
>> gpio.write(ledPin, ledState)
end>> )
>

Oh, hey I just tried "turbo mode" and "Save to ESP" works, but it doesn't echo much to the terminal.
> local FILE="ledtry2.lua" file.remove(FILE) file.open(FILE,"w+") uart.setup(0,115200,8,0,1,0)
> >> > >
--Done--
>

>
> dofile("ledtry2.lua")