Left for archival purposes.

User avatar
By gerardwr
#3163 A function to print the content of a file.

Code: Select allfile.print("init.lua")


currently I use:
Code: Select all-- print the content of a file
-- Use as : printfile("name_of_file")
printfile = function (name)
  file.open(name)
  repeat
    line=file.readline()
    if line then line=(string.gsub(line,"\n","")) print(line) end
  until not line
  file.close()
end
User avatar
By zeroday
#3174
Hans174 wrote:Hello,

A memory module to read from and to write to the ES8266 would be fine.
One could then write drivers in LUA.

Code: Select allmemory.read(address)              -- returns the 32 bit value of the 32 bit address
memory.write(address, value)      -- writes the 32 bit value to the 32 bit address


Hans


Writing a driver by write/read memory?
I think this can be done and better done using SDK. kind of dangerous.
They (vendor) have not provide a doc to how to manipulate with register yet.
User avatar
By zeroday
#3175
gerardwr wrote:A function to print the content of a file.

Code: Select allfile.print("init.lua")


currently I use:
Code: Select all-- print the content of a file
-- Use as : printfile("name_of_file")
printfile = function (name)
  file.open(name)
  repeat
    line=file.readline()
    if line then line=(string.gsub(line,"\n","")) print(line) end
  until not line
  file.close()
end


this can be done by write this function in a LUA MODULE
and use "require" to load this module.
save this to "myfile.lua"
Code: Select all--myfile.lua

local myfile = {}
function myfile.print(name)
  file.open(name)
  repeat
    local line=file.readline()
    if line then line=(string.gsub(line,"\n","")) print(line) end
  until not line
  file.close()
end
return myfile


use it:
Code: Select allmf=require("myfile")
mf.print("init.lua")
User avatar
By alonewolfx2
#3209 Can you add driver for ds18b20 temprature sensor. driver is here.

https://github.com/pilotniq/esp8266-frankenstein/commit/ff4d8c4124f9ef5a383bb29c69a80f5ab5c5e48d