adxl34x - adxl34x 3 Axis accelerometer currently supports adxl345 adxl346#

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

adxl34x.init(i2c_id)#

adxl34x Initialization

Parameters

Incoming Value Type

Explanation

number

The i2c bus id

Return Value

return value type

explanation

bool

Successful return true

Examples

adxl34x.init(0)

adxl34x.get_data()#

Get adxl34x data

Parameters

None

Return Value

return value type

explanation

table

adxl34x Data

Examples

local adxl34x_data = adxl34x.get_data()
log.info("adxl34x_data", "adxl34x_data.x"..(adxl34x_data.x),"adxl34x_data.y"..(adxl34x_data.y),"adxl34x_data.z"..(adxl34x_data.z))