l3g4200d - l3g4200d Three-Axis Digital Gyroscope 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 l3g4200d = require "l3g4200d"
i2cid = 0
i2c_speed = i2c.FAST
sys.taskInit(function()
i2c.setup(i2cid,i2c_speed)
l3g4200d.init(i2cid)--initialization, passing in i2c_id
while 1 do
local l3g4200d_data = l3g4200d.get_data()
log.info("l3g4200d_data", l3g4200d_data.x,l3g4200d_data.y,l3g4200d_data.z)
sys.wait(1000)
end
end)
l3g4200d.init(i2c_id)#
l3g4200d Initialization
Parameters
Incoming Value Type |
Explanation |
---|---|
number |
The i2c bus id |
Return Value
return value type |
explanation |
---|---|
bool |
Successful return true |
Examples
l3g4200d.init(0)
l3g4200d.get_data()#
Get l3g4200d data
Parameters
None
Return Value
return value type |
explanation |
---|---|
table |
l3g4200d Data |
Examples
local l3g4200d_data = l3g4200d.get_data()
log.info("l3g4200d_data", l3g4200d_data.x,l3g4200d_data.y,l3g4200d_data.z)