cht8305c - cht8305c 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 cht8305c = require "cht8305c"
i2cid = 0
i2c_speed = i2c.FAST
sys.taskInit(function()
    i2c.setup(i2cid,i2c_speed)
    cht8305c.init(i2cid)--initialization, passing in i2c_id
    while 1 do
        local data = cht8305c.get_data()
        if data and data.RH then
            local tmp = string.format("RH: %.2f T: %.2f ℃", data.RH*100, data.T)
            log.info("cht8305c", tmp)
        else
            log.info("cht8305c", "Read Failed")
        end
        sys.wait(1000)
    end
end)

cht8305c.init(i2c_id)#

cht8305c Initialization

Parameters

Incoming Value Type

Explanation

number

The i2c bus id

Return Value

return value type

explanation

bool

Successful return true

Examples

cht8305c.init(0)

cht8305c.get_data()#

Get cht8305c data

Parameters

None

Return Value

return value type

explanation

table

cht8305c Data

Examples

None