tsl2561 - tsl2561 light intensity 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 tsl2561 = require "tsl2561"
i2cid = 0
i2c_speed = i2c.FAST
sys.taskInit(function()
    i2c.setup(i2cid,i2c_speed)
    tsl2561.init(i2cid)--initialization, passing in i2c_id
    while 1 do
        local tsl2561_data = tsl2561.get_data()
        log.info("tsl2561_data", tsl2561_data.."Lux")
        sys.wait(1000)
    end
end)

tsl2561.init(i2c_id)#

tsl2561 Initialization

Parameters

Incoming Value Type

Explanation

number

The i2c bus id

Return Value

return value type

explanation

bool

Successful return true

Examples

tsl2561.init(0)

tsl2561.get_data()#

Get tsl2561 data

Parameters

None

Return Value

return value type

explanation

table

tsl2561 Data

Examples

local tsl2561_data = tsl2561.get_data()
log.info("tsl2561_data", tsl2561_data.."Lux")