lis2dh12 - lis2dh12 Three-axis 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 lis2dh12 = require "lis2dh12"
i2cid = 0
i2c_speed = i2c.FAST
sys.taskInit(function()
i2c.setup(i2cid,i2c_speed)
lis2dh12.init(i2cid)--initialization, passing in i2c_id
while 1 do
local lis2dh12_data = lis2dh12.get_data()
log.info("lis2dh12_data", "lis2dh12_data.x"..(lis2dh12_data.x),"lis2dh12_data.y"..(lis2dh12_data.y),"lis2dh12_data.z"..(lis2dh12_data.z),"lis2dh12_data.temp"..(lis2dh12_data.temp))
sys.wait(1000)
end
end)
lis2dh12.get_data()#
Get lis2dh12 data
Parameters
None
Return Value
return value type |
explanation |
---|---|
table |
lis2dh12 Data |
Examples
local lis2dh12_data = lis2dh12.get_data()
log.info("lis2dh12_data", "lis2dh12_data.x"..(lis2dh12_data.x),"lis2dh12_data.y"..(lis2dh12_data.y),"lis2dh12_data.z"..(lis2dh12_data.z),"lis2dh12_data.temp"..(lis2dh12_data.temp))