bmx - bmx The air pressure sensor currently supports bmp180 bmp280 bme280 bme680 will automatically judge the device#

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 bmx = require "bmx"
i2cid = 0
i2c_speed = i2c.SLOW
sys.taskInit(function()
    i2c.setup(i2cid,i2c_speed)
    bmx.init(i2cid)--initialization, passing in i2c_id
    while 1 do
        local bmx_data = bmx.get_data()
        if bmx_data.temp then
            log.info("bmx_data_data.temp:"..(bmx_data.temp).."°C")
        end
        if bmx_data.press then
            log.info("bmx_data_data.press:"..(bmx_data.press).."hPa")
        end
        if bmx_data.high then
            log.info("bmx_data_data.high:"..(bmx_data.high).."m")
        end
        if bmx_data.hum then
            log.info("bmx_data_data.hum:"..(bmx_data.hum).."%")
        end
        sys.wait(1000)
    end
end)

bmx.get_data()#

Get bmx data

Parameters

None

Return Value

return value type

explanation

table

bmx Data

Examples

local bmx_data = bmx.get_data()
if bmx_data.temp then
    log.info("bmx_data_data.temp:"..(bmx_data.temp).."°C")
end
if bmx_data.press then
    log.info("bmx_data_data.press:"..(bmx_data.press).."hPa")
end
if bmx_data.high then
    log.info("bmx_data_data.high:"..(bmx_data.high).."m")
end
if bmx_data.hum then
    log.info("bmx_data_data.hum:"..(bmx_data.hum).."%")
end