I suppose it is possible, but I've no BMP080 or BMP180 here
No worries, i can try it and try also to write code. But the problem is :how to wire it with one gpio? Or we must use two gpio, I completely ignore what is an i2c
With I2C you can have *lots* of devices all connected to the same two analogue pins. They are all in parallel but all have their own address and so only one item at a time is sending data on the wires. I have a BHV1750 light sensor and a bmp180 wired like this in my greenhouse and it works well.
Be aware of voltage levels though and try not to mix 5V and 3.3V singals as it has been causing stability problems. Level comverters on ebay are cheap. I have just this week added items to try and solve this issue.
Also, keep the I2C wires as short as possible and test it all out before you permanently install it.
Dennis wrote: here's working code for dimmer/switch on GPIO2, and DHT11 on GPIO0, and WITH BOTH TEMPERATURE AND HUMIDITY readout (new TCP command sent to nodeMCU is GETHUM).
Dennis, it doesn't read nothing from dht and respond with NIL value (esp crash after with a panic)....
DHT on GPIO0, correct?
EDIT: try to send manually command from esplorer to debug:
PORT OPEN 9600
print("DHT11", dofile("dht22.lua").read(4))
DHT11 nil 0
why ?
RE-EDIT : try also to connect to GPIO2, same result! Try to reupload other library with getTemp and it works, so DHT hardware is good.
Sorry, I have not changed the commented lines. Syntax for the dht22.read function has changed from last to present version, for manual testeing you now need to use
Explanation for params: the "4" is the pin used, the first boolean "false" says it is no DHT22 but a DHT11, the second bool "false" means we do not want to read humidity but temperature.
Make sure you use the latest lua examples, you need to replace both init.lua and dht22.lua.
You get back more than one value from the read command.
Check your dht22.lua. At the end, you should see:
if hum then
return h
else
return t
end
can you confirm these lines exist at the enf of your dht22.lua?
The original dht22.lua has just one line: "return t, h", which will not work since init.lua expects just one value to be given back.
You need the modified dht22.lua, which only returns one value.