ap3216c - ap3216c Light 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
PROJECT = "ap3216c"
VERSION = "1.0.0"
sys = require("sys")
ap3216c=require("ap3216c")
local i2c_id = 1
function ap32_test()
i2c.setup(i2c_id,i2c.SLOW)
ap3216c.init(i2c_id)
sys.wait(120)
while true do
local ir=ap3216c.ir()
local ALS=ap3216c.als()
local PS=ap3216c.ps()
log.info("ap3216 read ir",ir)
log.info("ap3216 read ALS",ALS)
log.info("ap3216 read PS",PS)
sys.wait(500)
end
end
sys.taskInit(ap32_test)
sys.run()
ap3216c.init(i2cid)#
Initialization ap3216c
Parameters
Incoming Value Type |
Explanation |
---|---|
int |
i2cid i2c id used, or an instance of software i2c |
Return Value
return value type |
explanation |
---|---|
nil |
No return value |
Examples
None
ap3216c.ir()#
Read infrared intensity
Parameters
None
Return Value
return value type |
explanation |
---|---|
int |
Returns the infrared intensity value or if the read fails nil |
Examples
None
ap3216c.als()#
Read light intensity
Parameters
None
Return Value
return value type |
explanation |
---|---|
int |
Returns the light intensity value, if the read fails.nil |
Examples
None
ap3216c.ps()#
Read Distance
Parameters
None
Return Value
return value type |
explanation |
---|---|
int |
Returns the distance value, or if the read fails nil |
Examples
None