cdj wrote: Dennis now i've :
> print(dofile("bmp085.lua").read(4, 3))
18.893415127304 764.84547162023
Vladimir told me that we need :
--local t = .read(...); print(t) for temperature
--local _, p = .read(...); print(p) for pression
tried in bmp085.lua to put at the end instead of return t, p :
if pression then
return p
else
return t --, p
end
according to modified dht22.lua when you write if hum....
but don't understand how to make the function when i read "pression" ....because in dht there's
local read = function(pin, dht22, hum)
sob
Please it miss very little !
Dario
OK, so you got a reading now from your sensor, good.
To alter the "read" function of the bmp085.lua, to accept one additional boolean argument "pression", you need to replace
local read = function(sda, scl, oss)
with
local read = function(sda, scl, oss, pression)
and then you need to query it from init.lua as follows,
temperature:
dofile("bmp085.lua").read(4, 3,false,false)
pressure:
dofile("bmp085.lua").read(4, 3,false,true)
I'm sure there is also a way to return multiple values and reference them in a table object (similar to array in c), but I don't know how to.
I updated github repo with new init.lua improved for dht11 read stability, btw.
VasilijHCN wrote: Look at this
homes-smart.ru/index.php/oborudovanie/be...-servisa-narodmon-ru
Here is alternative firmware with many sensor type support, in free version maybe we can get temperature info from it.
Sensors read command is http://ESP_IP/sensors
Data are output through a point from a comma. (
I get this dsw1:17.9;dsw2:17.9;
dsw -ds18b20 sensor(dsw1 dsw2 sensor numbers)
In IOT automation we need request temperature from http://192.168.1.113/sensors
and extract temperature data from dsw1:17.9;dsw2:17.9;
My programming skill is to low for this.
Just tried that FW, and it looks very interesting.
But it is commercial, no open-source and you need to pay for it to enable all features. And we need to remove whole HTTP protocol, just to get a float value (and also put together http GET request instead of sending a simple string command). I like the lua FW much more, since it offers almost same flexibility as the arduino platform.
I think, the better solution is turning this code from esp8266 forums into a "library" (omit the webserver part, and expose the readTemp function and give the needed values as arguments):
www.esp8266.com/viewtopic.php?f=19&t=752
Can someone with ds18b20 sensor in reach confirm this is working code with nodeMCU 0.9.4?