wifi-tally_Oostendam/nodemcu-firmware/lua_modules/hdc1000/HDC1000-example.lua
Eljakim Herrewijnen 50b5fc1824 Initial commit
2021-09-27 21:52:27 +02:00

17 lines
526 B
Lua

local HDC1000 = require("HDC1000")
local sda, scl = 1, 2
local drdyn = false
do
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
HDC1000.setup(drdyn)
-- prototype is config(address, resolution, heater)
HDC1000.config() -- default values are used if called with no arguments.
print(string.format("Temperature: %.2f °C\nHumidity: %.2f %%", HDC1000.getTemp(), HDC1000.getHumi()))
-- Don't forget to release it after use
HDC1000 = nil -- luacheck: no unused
package.loaded["HDC1000"] = nil
end