qmc5883l - qmc5883l geomagnetic 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 qmc5883l = require "qmc5883l"
i2cid = 0
i2c_speed = i2c.FAST
sys.taskInit(function()
    i2c.setup(i2cid,i2c_speed)
    qmc5883l.init(i2cid)--initialization, passing in i2c_id
    while 1 do
        local qmc5883l_data = qmc5883l.get_data()
        log.info("qmc5883l_data", qmc5883l_data.x,qmc5883l_data.y,qmc5883l_data.z,qmc5883l_data.heading,qmc5883l_data.headingDegrees)
        sys.wait(1000)
    end
end)

qmc5883l.init(i2c_id)#

qmc5883l Initialization

Parameters

Incoming Value Type

Explanation

number

The i2c bus id

Return Value

return value type

explanation

bool

Successful return true

Examples

qmc5883l.init(0)

qmc5883l.get_data()#

Get qmc5883l data

Parameters

None

Return Value

return value type

explanation

table

qmc5883l Data

Examples

local qmc5883l_data = qmc5883l.get_data()
log.info("qmc5883l_data", qmc5883l_data.x,qmc5883l_data.y,qmc5883l_data.z,qmc5883l_data.heading,qmc5883l_data.headingDegrees)