hello!
in my project i want to measure the battery voltage and i am using the (node.readvdd33()) command.
as you know , that command doesnt work in staion mode .
so what i did is to run that command before connecting to a WIFI and save the value in txt file.
and its working good.
after that i created a LUA file that print the value from the txt file:
file.open("value.txt", "r")
print(file.read('\r'))
file.close()
and when i press do file for the LUA file its pring the value.
but when i am trying to send the value to easyiot with that command:
elseif string.find(payload,"BStatus") then
print("Received BStatus request")
myval = nil
while myval == nil do
print("reading value")
myval = dofile("BStatus.lua")
end
print("read "..myval)
conn:send((myval))
it gives me
Input: BStatus
Received BStatus request
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
dorroddorrod wrote: hello!
in my project i want to measure the battery voltage and i am using the (node.readvdd33()) command.
as you know , that command doesnt work in staion mode .
so what i did is to run that command before connecting to a WIFI and save the value in txt file.
and its working good.
after that i created a LUA file that print the value from the txt file:
file.open("value.txt", "r")
print(file.read('\r'))
file.close()
and when i press do file for the LUA file its pring the value.
but when i am trying to send the value to easyiot with that command:
elseif string.find(payload,"BStatus") then
print("Received BStatus request")
myval = nil
while myval == nil do
print("reading value")
myval = dofile("BStatus.lua")
end
print("read "..myval)
conn:send((myval))
it gives me
Input: BStatus
Received BStatus request
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
reading value
3239
and stuck.
what am i doing wrong?
I do not know much about LUA programming, but I just want to tell you for new API function in beta V0_8 to report battery status: