(node.readvdd33())

6 years 8 months ago #1223 by dorroddorrod
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?

Please Log in or Create an account to join the conversation.

6 years 8 months ago #1231 by EasyIoT
Replied by EasyIoT on topic (node.readvdd33())

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:

http://[IP]/Api/EasyIoT/Control/Module/Virtual/[Node address]/ControlBattery/[battery status]

IP - server IP
node address - virtual node address
battery status - value between 0 and 100

Please Log in or Create an account to join the conversation.

6 years 8 months ago #1238 by dorroddorrod
Replied by dorroddorrod on topic (node.readvdd33())
thank you .
do you have an idea how can i use it in my case?

Please Log in or Create an account to join the conversation.

Time to create page: 0.219 seconds

Forum latest

  • No posts to display.