yet-another-dht22 Is leaner on HEAP!
Posted: Wed Feb 04, 2015 7:57 pm
The alternative DHT module is leaner on heap ( ~700b). See https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples
I have DHT11:
I made the following change to the module for DHT11 ( I don't have DHT22):
--h = 10 * b[1]
--t = 10 * b[3]
h = b[1]
t = b[3]
..it will return integer values for t and h.
This should be included in the usage example:
t, h = require("yet-another-dht22").read(4)
-- unload module
yet-another-dht22 = nil
package.loaded["yet-another-dht22"] = nil
-- t and h remain available to your program, call above to update variables and release
print(t)
print(h)
-Cheers!
I have DHT11:
I made the following change to the module for DHT11 ( I don't have DHT22):
--h = 10 * b[1]
--t = 10 * b[3]
h = b[1]
t = b[3]
..it will return integer values for t and h.
This should be included in the usage example:
t, h = require("yet-another-dht22").read(4)
-- unload module
yet-another-dht22 = nil
package.loaded["yet-another-dht22"] = nil
-- t and h remain available to your program, call above to update variables and release
print(t)
print(h)
-Cheers!