Current Lua downloadable firmware will be posted here

User avatar
By alonewolfx2
#2760
ystrem wrote:
alonewolfx2 wrote:
ystrem wrote:It will be possible to sleep device the FW ? :] I want to make my home automation on Atmega328+nRf24, but the network library is still buggy. And then came ESP8266 :D

Is nrf24 and arduino buggy ? You are wrong place: ) esp sdk is very bulgu more than arduino +nrf now : )
I am using atmega328 + 433mhz rf +nrf24 and enc24j80. Its more stable more than esp. Esp platform growing every day but now Its is a child. Maybe we can use without bug one day


I can't get work nrf24 network library, I want to sleep node parent node and if message arrive then send it to base, but the node sleeps :D. Because the limitation of 6 pipes in nrf24. I know about the deep sleep function, it's not problem for me. I want the radion turn off, then I can wake it by other MCU. But there is no AT command for sleep. I tried to compile IoT example, but after 2 days I get worked only ct-ng compiler.

there is no at command for sleep. you can define your own at function for deep sleep. you must study at example. not iot example.
User avatar
By cendev
#2786
gerardwr wrote:
cendev wrote:I've added the scripts as attachment :) hope they'll help =)


I had a look at your scripts and converted them for (my) use of the serial console.

I saw in your video that you display the content of a file by 2 commands:
filename="filename.lua"
dofile("fileread.lua")

I tried using a function for a 1-liner that allows the filename as a parameter. This work, I like it!

I created the file functions.lua and uploaded it to the ESP
Code: Select all printfile = function (name)
 file.open(name)
  repeat
    line=file.readline()
    print(line)
  until not line
end


On the ESP I execute the file functions.lua once. After that I can use the command printfile("filename.lua") to display the contents of the file.
Code: Select all> dofile("functions.lua")
> printfile("functions.lua")
printfile = function (name)
  file.open(name)
  repeat
    line=file.readline()
    print(line)
  until not line
end
nil
>


Please note:
- I do not have to use seek to determine the end of file
- the last printed line = NIL, probably because the last line in the file is blank
- in this way you can extend the supported Lua commands as if they were built-in commands

Using this way of working I intend to:
- code all default functions I need in functions.lua. After dofile all functions are available by just typing the name of the function and the required variables.
- When all testing is done, and I am satisfied with the functions I upload the file functions.lua to init.lua to execute the file at boot time.
- for every additional lua file I code, the functions defined are available for use. As a kind of library.

Neat, huh!


That's perfect :) my way for reading file was very sloppy :D i tried a similar way with "not line" but strange part was it returned with an endless loop which i thought interesting... looks like i did something wrong :) Thx for the codes, i'll test them asap =)
User avatar
By alonewolfx2
#2787
cendev wrote:it does the job for me =) still kinda buggy in some places but tomorrow after adding the highlight supported editor part and making the gui look better, it'll be something worth to bear with :)

have you any progress :) and check your forum inbox Emre :)