am2320 - am2320 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!

Tip

This library has its own demo,click this link to view the demo example of am2320.

Example

-- Usage Examples
local am2320 = require "am2320"
sys.taskInit(function()
    local i2c_id = 0
    i2c.setup(i2c_id, i2c.FAST)
    while 1 do
        local t, h = am2320.read(i2c_id)
        log.info("am2320", "Temperature ", t, "Humidity", h)
        sys.wait(1000)
    end
end)

am2320.read(i2c_id)#

Read temperature and humidity data

Parameters

Incoming Value Type

Explanation

int

i2c The id of the bus, which defaults to 0, needs to be filled in according to the actual wiring, for example 0/1/2/3

Return Value

return value type

explanation

number

Temperature in degrees Celsius, returned if reading fails nil

number

Relative humidity, in 1%, returned if reading fails nil

Examples

None