aht10 - aht10 Temperature and humidity sensor#
Adaptation status unknown
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Example
--Note: due to the use of sys.wait() all apis need to be used in the coroutine
-- Usage Examples
local aht10 = require "aht10"
i2cid = 0
i2c_speed = i2c.FAST
sys.taskInit(function()
i2c.setup(i2cid,i2c_speed)
aht10.init(i2cid)--initialization, passing in i2c_id
while 1 do
local aht10_data = aht10.get_data()
log.info("aht10_data", "aht10_data.RH:"..(aht10_data.RH*100).."%","aht10_data.T"..(aht10_data.T).."℃")
sys.wait(1000)
end
end)
aht10.init(i2c_id)#
aht10 Initialization
Parameters
Incoming Value Type |
Explanation |
---|---|
number |
The i2c bus id |
Return Value
return value type |
explanation |
---|---|
bool |
Successful return true |
Examples
aht10.init(0)
aht10.get_data()#
Get aht10 data
Parameters
None
Return Value
return value type |
explanation |
---|---|
table |
aht10 Data |
Examples
local aht10_data = aht10.get_data()
log.info("aht10_data", "aht10_data.RH:"..(aht10_data.RH*100).."%","aht10_data.T"..(aht10_data.T).."℃")